I cannot authorize Google OAuth on ios, safari always say
400 That's an error.
Invalid parameter value for redirect_uri: Missing scheme: com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8
I have checked API Key, Client_ID, client_secret on Google Console page many times and also create url scheme in the xcode.
Here are my Swift code:
oauthswift = OAuth2Swift( consumerKey: "xxxxx-3lmlrubo9345ng4qhtf62ud1i02m6ta8.apps.googleusercontent.com", consumerSecret: "xxxtg6qslUOC2np1sBg0hnWgBcpZb4", authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth", responseType: "token" ) let handle = oauthswift.authorize( withCallbackURL: URL(string: "com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8")!, scope: "profile", state:"GOOGLE", success: { credential, response, parameters in print(credential.oauthToken) // Do your request }, failure: { error in print(error.localizedDescription) } )
Could you help me ?
It is pretty simple fix for this issue: just set prefix before your schema.
Example: your schema parameter:
com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8
the identifier of your iOS application:
net.the-red-queen.www
so, value for your redirect URI parameter is:
net.the-red-queen.www:com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8
I think the actual issue is that you didn't specify a full URI. (The schema doesn't have a colon and then a path.) Try making your redirect_uri look something like the following (properly encoded, of course):
com.googleusercontent.apps.984813079630-3lmlrubo9345ng4qhtf62ud1i02m6ta8:/oauth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With