Closed appdeveloper9is closed 1 month ago
Have the same error
Hi @appdeveloper9is, seems this has been a long running issue. Can I ask if you have tried any of the solutions from this thread?
I found a solution to this issue after following the advice of #494 and #986 issues. It seems like I failed to understand that the default scheme of the app is sort of an "endpoint" and that a new "endpoint" should be created for the authentication process. Both "endpoints" will open the app but only one of them is expecting the auth data.
This meant that for a scheme com.myapp
you should create a com.myapp.auth
scheme by adding it to the build.grade:
android {
defaultConfig {
manifestPlaceholders = [
appAuthRedirectScheme: 'com.myapp.auth'
]
}
}
Then on the config
, you would need to point to this new auth scheme:
const config = {
...,
redirectUrl: 'com.myapp.auth://*',
},
Finally on Keycloak you would need to change Valid Redirect URI
and Valid post logout redirect URIs
to com.myapp.auth
so that it points to the "endpoint" that expects the results instead of the main application.
Finally you shouldn't need to modify the default Android Manifest file since it already has it's default scheme set up. Adding anything here would result on a prompt making you choose between the different schemes within the app.
Issue
When user is authenticated, its redirected back to app and it show this error [Error: Data intent is null]. I am currently using schemes. When it comes back to app it shows nothing in console.log and this error comes which i mentioned above.
App,js :
const config = { issuer: 'http://domain.com/realms/NewWorld', clientId: 'Check', redirectUrl: 'com.myapp://*', serviceConfiguration: { authorizationEndpoint:
http://domain.com/realms/NewWorld/protocol/openid-connect/auth
, tokenEndpoint:http://domain.com/realms/NewWorld/protocol/openid-connect/token
,},
scopes: ['openid', 'profile', 'email', 'offline_access'], }; const App = () => { const handleLogin = async () => { try { const authState = await authorize(config);
};
return (
); };
Android Manifest :
In build.gradle file :
my keycloak website configuration:
Environment
Android
react-native
Version:e.g. 0.73.5
react-native-app-auth
Version:e.g. 7.1.3