photo%sharing%in%app%inventor%cs.wellesley.edu/~tinkerblocks/ccscne13-erdman.pdf ·...

1
Photo Sharing in App Inventor Emily Erdman ‘13 Advisor: Franklyn Turbak Wellesley College Computer Science Department Uploading pictures to the internet allows them to be viewed through a URL. App Inventor can access pictures through a URL, providing apps with usertouser picture sharing capabiliJes. However, previously there was no way to upload pictures or drawings to a photo sharing site from a phone. With only one part of the equaJon, apps could not share images created in the app between users. The Image Sharing Problem Consumer (App) Service Provider (Photo Sharing Site) User Direct user to login and authorizaJon pages Redirect to app with token User grants access to app OAuth 2.0 Protocol The Blocks The service you want to use. The file path to the image on the phone. The consumer key and secret obtained from the photo sharing site upon registering the app. The Method Block The Event Handler Block The URL of the uploaded image. The Log In Problem The main hurdle to uploading images to photo sharing sites is associaJng the image with an account. Uploading an image requires access to a user’s ‘private resources’ within their account. These resources are usually accessed by logging in to the service. For an app to access an account it must be authorized by the service provider, in this case the photo sharing site. The OAuth Solu?on OAuth is an authorizaJon protocol that provides a soluJon to the log in problem. Instead of giving their username and password directly to the app, the user is directed to a login page associated with the photo sharing site. I implemented the OAuth protocol in the Java code base of App Inventor. In the Web Component I added two blocks that use OAuth to access the user’s account and upload an image. Consumer (App) Service Provider (Photo Sharing Site) User Request Token Receive Token Step 1 (Get Request Token) Direct user to login and authorizaJon pages Request Access Token Receive Access Token Redirect to app with verifier token User grants access to app Step 2 (Get Verifier) Step 3 (Get Access Token) OAuth 1.0a Protocol What is App Inventor? App Inventor is a blocksbased programming environment for creaJng Android apps. App Inventor simplifies the process of making an app by breaking it down into two parts. First, the App Inventor user drags and drops components into a representaJon of the Android phone screen. Second, they use a blocksbased programming environment to control the funcJonality of the components. Photo Sharing Sites There are many great photo sharing sites that allow users to upload images for free, providing quick and easy picture sharing. Many of these sites also have ApplicaJon Programming Interfaces (APIs) that provide a way to use the services of the site without having to visit the site in a web browser. The APIs of Facebook, Flickr, and Picasa allow an applicaJon to upload images to an account without visiJng the web page. Funded By: Provost's Office Faculty Research Fund for Science & Math (IBM)

Upload: others

Post on 20-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Photo%Sharing%in%App%Inventor%cs.wellesley.edu/~tinkerblocks/CCSCNE13-erdman.pdf · Photo%Sharing%in%App%Inventor% Emily&Erdman&‘13& Advisor:&Franklyn&Turbak& Wellesley&College&Computer&Science&Department

Photo  Sharing  in  App  Inventor  Emily  Erdman  ‘13  

Advisor:  Franklyn  Turbak  Wellesley  College  Computer  Science  Department  

Uploading   pictures   to   the   internet   allows   them   to   be  viewed   through  a  URL.  App   Inventor   can  access  pictures  through   a   URL,   providing   apps  with   user-­‐to-­‐user   picture  sharing   capabiliJes.   However,   previously   there   was   no  way  to  upload  pictures  or  drawings  to  a  photo  sharing  site  from  a  phone.  With  only  one  part  of   the  equaJon,   apps  could  not  share  images  created  in  the  app  between  users.  

The  Image  Sharing  Problem  

Consumer  (App)   Service  Provider  (Photo  Sharing  Site)  

User  

Direct  user  to  login  and  authorizaJon  pages  

Redirect  to  a

pp  with  toke

n  User  g

rants  access  t

o  app  

OAuth  2.0  Protocol  

The  Blocks  The  service  you  want  to  use.   The  file  path  to  

the  image  on  the  phone.  

The  consumer  key  and  secret  obtained  from  the  photo  sharing  site  upon  registering  the  app.    

The  Method  Block  

The  Event  Handler  Block  

The  URL  of  the  uploaded  image.  

The  Log  In  Problem  The   main   hurdle   to   uploading   images   to  photo  sharing  sites  is  associaJng  the  image  with   an   account.   Uploading   an   image  requires   access   to   a   user’s   ‘private  resources’   within   their   account.   These  resources   are   usually   accessed   by   logging  in   to   the   service.   For   an   app   to   access   an  account   it   must   be   authorized   by   the  service   provider,   in   this   case   the   photo  sharing  site.  

The  OAuth  Solu?on  OAuth   is   an   authorizaJon   protocol   that   provides   a  soluJon   to   the   log   in   problem.   Instead   of   giving   their  username  and  password  directly   to   the   app,   the  user   is  directed   to   a   login   page   associated   with   the   photo  sharing  site.  

I  implemented  the  OAuth  protocol  in  the  Java  code  base  of  App  Inventor.  In  the  Web  Component  I  added  two  blocks  that  use  OAuth  to  access  the  user’s  account  and  upload  an  image.    

Consumer  (App)   Service  Provider  (Photo  Sharing  Site)  

User  

Request  Token  

Receive  Token  Step  1  (Get  Request  Token)  

Direct  user  to  login  and  authorizaJon  pages  

Request  Access  Token  

Receive  Access  Token

 

Redirect  to  app  with    

verifier  token  

User  grants  access  to  app  

Step  2  (Get  Verifier)  

Step  3  (Get  Access  Token)  

OAuth  1.0a  Protocol  

What  is  App  Inventor?  App   Inventor   is   a   blocks-­‐based   programming   environment   for   creaJng   Android  apps.  App   Inventor  simplifies   the  process  of  making  an  app  by  breaking   it  down  into   two  parts.   First,   the  App   Inventor  user  drags  and  drops   components   into  a  representaJon   of   the   Android   phone   screen.   Second,   they   use   a   blocks-­‐based  programming  environment  to  control  the  funcJonality  of  the  components.  

Photo  Sharing  Sites  

There  are  many  great  photo  sharing  sites  that  allow  users  to  upload  images  for  free,  providing   quick   and   easy   picture   sharing.  Many  of  these  sites  also  have  ApplicaJon  Programming   Interfaces   (APIs)   that  provide   a  way   to   use   the   services   of   the  site   without   having   to   visit   the   site   in   a  web   browser.   The   APIs   of   Facebook,  Flickr,   and   Picasa   allow   an   applicaJon   to  upload   images   to   an   account   without  visiJng  the  web  page.  

Funded  By:  Provost's  Office    -­‐  Faculty  Research  Fund  for  Science  &  Math  (IBM)