I'm new to Android and am trying to make an app authenticate using oauth2 on a website (in which I only can setup the integration, getting a ClientId and defining the redirect_uri). This website only allows Uris as a redirect. It does not allow a custom scheme like: "br.com.myapp:/oauth2redirect". Given this, I setup "http://br.com.myapp/oauth2redirect" as my redirect_uri at the site.
I am using AppAuth:
implementation 'net.openid:appauth:0.8.1'
In my manifest file, I've added the intent-filter below:
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace">
<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:scheme="http"
android:host="br.com.myapp"
android:pathPrefix="/oauth2redirect" />
</intent-filter>
</activity>
In my "build.gradle", I setup:
manifestPlaceholders = [
'appAuthRedirectScheme': 'br.com.myapp'
]
Well, the app opens a CustomTabsIntent in which the target oauth provider website is opened. I'm able to insert user/pass. I'm then redirected to another page on the provider's site where I need to accept the authentication and then a blank page opens with the message:
This site can't be reached
br.com.myapp's server IP address could not be found
DNS_PROBE_FINISHED_NXDOMAIN
The address it is pointing to is my redirect uri: http://br.com.myapp/oauth2redirect?code=xxxx&state=xxxx
As far as I understand, this is correct. The problem is that my app is not catching this intent. Any tips?
Thanks in advance!