android - How can I automatically get OAuth 2.0 token and re-open my app? -


i'm working delivery.com api in building app, , current understanding of how oauth flow works is:

  1. i redirect user browser, explicitly sign in account. supply redirect_uri in process.
  2. upon sign in, user redirected redirect_uri access token
  3. i access token somehow, , use authenticate future actions in app

it's step 3 i'm struggling - i've set intent , intent-filter such correctly open browser step 1, , user correctly redirected app in step 2. leaves 2 problems:

  1. the redirect_uri re-opens app in background - browser never closes. i'm assuming there's simple fix this, haven't been able find it.
  2. how access token? solution redirect webpage display token, , have user manually copy , paste app? or can somehow automatically token, re-open app, , proceed?

edit: able working - i'm not sure causing issue in point #1 above, after changing things , forth few times started working had it. looks in future, had include following elements in manifest.xml work:

<action android:name=android.intent.action.view"/> <category android:name="android.intent.category.browsable"/> <category android:name="android.intent.category.default"/> <data android:scheme="myapp.randomname" android:host="my_url"/> 

regarding problem #2, able parse response using uri data = getintent().getdata() , calling data.getqueryparameter("fieldname").

instead of launching external browser , using intent filters should benefit more using webview directly in app , getting thru oauth it.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -