Open moin-maniar opened 1 year ago
Hello, I don't know if you found the solution for your problem, but I got the same and I finally resolved it.
In your AndroidManifest.xml
you should find a line mentionning android:networkSecurityConfig
:
<application
android:...
android:networkSecurityConfig="@xml/network_security_config"
android:...
If not, you can add this line.
In the network_security_config
file (located at app/src/main/res/xml
), ensure you have something like this
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<!-- If you are running on a device insert your computer IP -->
<domain includeSubdomains="true">your.keycloak.server.ip</domain>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</domain-config>
<base-config cleartextTrafficPermitted="false" />
</network-security-config>
In my case, my keycloak server IP was the IP of my Mac because I'm running it locally for test purpose (192.168.X.X)
Hope this helps
Hello, I am having the same error response after successful login to keycloak:
{"nativeStackAndroid":[{"lineNumber":648,"file":"AuthorizationService.java","methodName":"doInBackground","class":"net.openid.appauth.AuthorizationService$TokenRequestTask"},{"lineNumber":579,"file":"AuthorizationService.j ava","methodName":"doInBackground","class":"net.openid.appauth.AuthorizationService$TokenRequestTask"},{"lineNumber":394,"file":"AsyncTask.java","methodName":"call","class":"android.os.AsyncTask$3"},{"lineNumber":264,"file":"Fut ureTask.java","methodName":"run","class":"java.util.concurrent.FutureTask"},{"lineNumber":305,"file":"AsyncTask.java","methodName":"run","class":"android.os.AsyncTask$SerialExecutor$1"},{"lineNumber":1145,"file":"ThreadPoolExecu tor.java","methodName":"runWorker","class":"java.util.concurrent.ThreadPoolExecutor"},{"lineNumber":644,"file":"ThreadPoolExecutor.java","methodName":"run","class":"java.util.concurrent.ThreadPoolExecutor$Worker"},{"lineNumber":1012,"file":"Thread.java","methodName":"run","class":"java.lang.Thread"}],"userInfo":null,"message":"Network error","code":"token_exchange_failed"}
this is my config:
const config = { issuer:
${dHost}/realms/${dRealm}
, clientId:${dClientId}
, redirectUrl: 'com.myapp://callback', scopes: ['openid', 'profile', 'offline_access','email'], allowInsecureConnections:true, serviceConfiguration:{ authorizationEndpoint:${dHost}/realms/${dRealm}/protocol/openid-connect/auth
, tokenEndpoint:${dHost}/realms/${dRealm}/protocol/openid-connect/token
, }, dangerouslyAllowInsecureHttpRequests: true, public_client : true, response_type: 'code token', };
as well included network security config:
api.keycloak.localhost localhost 192.168.0.22
but no luck. Please advise...
@emir0903d Were you able to resolve this issue?
Issue
Getting network error after successfully login. This is my config. const config = { issuer: 'http://localhost:9080/auth/realms/jhipster', clientId: 'web_app', redirectUrl: 'com.authproject.auth:/oauth2callback', scope: ['openid', 'nst-eid-oid', 'nst-email', 'nst-profile', 'nst-cloudid-authentication-method'] };
Please help me to resolve this issue.
Environment
I am using Keycloak