-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handleAuthorizationResult, response is 'nil' on iOS #103
Comments
Hi @yassinejebli, the plugin needs a oauth2 server that follow the specs. The plugin is very generic and tries to support as much providers as possible but it needs a well implemented oauth2 server. I clicked on the link provided and it might be a good idea to have a look at the
I am certain that you understand that it is out of scope to debug your server side. |
@moberwasserlechner thanks for responding. I think you should add in the url redirect_uri param as well as state. something like I think you got that link because you tested it out of context (directly on browser), to reproduce the issue it should be tested with in the plugin, redirection works fine on Android & on browser for me. Alternative solution could be using That page I hosted on netlify is just an HTML file which mocks the behaviour of an auth provider, code below
|
You're right of course. |
I mark this as a bug for now, because it works on web and Android. Although I'm unsure because you mock the backend. |
I saw this same behavior when trying to authorize using the implicit flow. I tweaked part of the } else if let responseData = response?.data {
do {
let jsonObj = try JSONSerialization.jsonObject(with: responseData, options: []) as! JSObject
call.resolve(jsonObj)
} catch {
self.log("Invalid json in response \(error.localizedDescription)")
call.reject(self.ERR_GENERAL)
}
} else {
call.resolve(parameters) // not sure if parameters is what should be passed, but it contains the access_token
} |
I implemented a similar workaround locally as well. You should create a PR vmdominguez-usaa and bask in open source accolades! |
Capacitor version:
Library version:
OAuth Provider:
it's just a simple html page with some script to redirect back to the app with data like access_token, userId, firstName...
Normally there should be a webview in the backend side that will redirect the mobile user to an auth provider which can be accessible only by that backend (whitelisted backend IP) then after successful login backend should send back the received data from that Auth provider.
Your Plugin Configuration
The text was updated successfully, but these errors were encountered: