flutter_appauth
flutter_appauth copied to clipboard
PlatformException(authorize_and_exchange_code_failed, Failed to authorize: Connection error making token request to 'https://xxx/realms/AAA/protocol/openid-connect/token': The certificate for this server is invalid. You might be connecting to a server that is pretending to be 'xxx' which could put your confidential information at risk...
Hi to Flutter app auth team.
I'm using the last version of flutter_appauth to connect with Keycloak server. Everything are working well, but I got an error when callback in IOS(it's working fine on Android).
PlatformException(authorize_and_exchange_code_failed, Failed to authorize: Connection error making token request to 'https://xxx/realms/AAA/protocol/openid-connect/token': The certificate for this server is invalid. You might be connecting to a server that is pretending to be 'xxx' which could put your confidential information at risk...
For iOS in info.plist:
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string><my_scheme></string> </array> </dict> </array>
Maybe it's problem from self-signed certificate. How could I solve this problem?
Hi @tungtt1501
Is your server using HTTPs ?
I thank this can be as you mentioned, a self-signed certifcate issue.
Check this stack over flow answer: https://stackoverflow.com/a/61312927/12461921
Hi @Dahkenangnon Yes, my server is using https. I've tried to apply the solution in https://stackoverflow.com/a/61312927/12461921 but it's not works. Another point to track: when I use the method "authorize" then it's working normal. I guess the problem come from the way implement of 2 methods. Any solution for this issue?
@tungtt1501
Can you please edit the issue's title. I forgot to remember you to edit it. The title is so long to read and people won't probably open it to help resolve your issue.
To get more help, I suggest you to edit it like e.g: Failed to authorize: connection error making token request.
You would need to do more research on if it's possible to resolve this. I don't have that level of knowledge to provide you an answer and one of the main reasons behind this is this plugin is a wrapper for native SDKs. You would need to look into seeing if those SDKs provide any means to get around the issue or if there's something else that iOS requires with your app's configuration
On a different note, should mention there isn't a team behind maintaining this particular plugin. I'm the sole maintainer of this plugin that in turn has received contributions by the community