MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
273 stars 246 forks source link

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... #386

Open tungtt1501 opened 1 year ago

tungtt1501 commented 1 year ago

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: `CFBundleURLTypes

CFBundleTypeRole Editor CFBundleURLSchemes ` Maybe it's problem from self-signed certificate. How could I solve this problem?
Dahkenangnon commented 1 year ago

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

tungtt1501 commented 1 year ago

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?

Dahkenangnon commented 1 year ago

@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.

MaikuB commented 1 year ago

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