0

I am doing OAuth2 authentication on Android. I get a "java.util.NoSuchElementException" error when trying to use the authorization code further down the line. After testing it seems that the call is correct, but I get nothing back..

My callback uri is set in the Settings Page, the Activity and the Manifest (see below). According to me it is not working because I am not in production.

One advice I received is to "set up your application as webapp", but it is not clear to me what steps I exactly have to take. Any advice?

Intent Filter set in the Manifest File.

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <data android:scheme="https://fibi22cj69"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/> </intent-
    filter>
Niels Vanwingh
  • 444
  • 4
  • 18

1 Answers1

1

Try like that:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data
        android:host="yourcallback.com"
        android:scheme="oauth" />
</intent-filter>

And in the client, set the callback url to oauth://yourcallback.com

Mickael B.
  • 3,544
  • 3
  • 17
  • 33
  • Thanks! Callback url in the client like this oauth: //ht tps ://xxx .com ? Don't mind the spaces, otherwise I cannot put it here.. – Niels Vanwingh Mar 07 '18 at 23:28
  • 1
    @NielsVanwingh you can replace the scheme with https if you want, just make sure you put the url in the `android:host` attribute in the manifest. – Mickael B. Mar 07 '18 at 23:44
  • Ok, thanks, seems ok, now I still need to find a usable url to work in Testing environment.. So this could work in Production.. – Niels Vanwingh Mar 07 '18 at 23:54