android - Uber OAuth Best Practices in Mobile App -


i'd make mobile app makes requests on behalf of user. understand following oauth flow:

  1. open user in web view give app access make requests on behalf
  2. when hit grant access, server side app receive call authorization code
  3. my server side app needs exchange authorization code access token

my confusion starts in step 2. uber makes request endpoint authorization code, have no way of knowing user authorization belongs to. can exchange access token , store in db 30 days, have no way of getting user use make requests.

one thought have user sign in app email address use key appropriate access token server app, have no way of associating access token email address in db table in first place.

i'm wondering best practices here. how mobile app supposed know access token use given user?

(i reached out uber api support directly, asked me open stackoverflow question instead)

obviously kind of broad question , highly dependent on type of app you're building, want user-flow like, etc etc i'll best point in right direction.

first, uber api has /v1/me endpoint return users first name, last name, , email address, among other things. 1 possible flow user opens app, go through whole oauth flow, , once exchange authorization code access token use (from server) make call out /v1/me endpoint , use either users email address or uuid key in database. if used email address, allow users login app using same email address , allow account creation process oauth flow.

i'm not mobile developer, understanding of embedded web views can use cookies other browser. in case, thing use sessions / cookies. assuming have kind of identifier existing users, add cookie web server , when user gets redirected web server authorization code, attached cookie tell user associate access token.

finally, uber developer platform includes state parameter in authorization phase of oauth flow seen here https://developer.uber.com/docs/authentication similar describe in previous paragraph, except instead of using cookies store user identifier in state parameter , it'll sent when user re-directs. can use piece of information tie access token specific user in db.

i hope helps! don't hesitate reach out if you're still confused.

cheers!


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -