问题
When i try to authenticate my app in Google Plus via Web i get an error:
Error: invalid_request Invalid parameter value for redirect_uri: Missing authority: MY_APP:/oauth2callback
I did everything according to the instructions:
https://developers.google.com/+/mobile/ios/getting-started
However, authentication with Google Plus application runs fine. What's the problem?
回答1:
I encountered the same problem because I was using an unconventional bundle id
i.e it was not in the format com.company.appname
I found the solution here. https://code.google.com/p/google-plus-platform/issues/detail?id=961
you have to add signIn.useClientIDForURLScheme = YES;
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.clientID = kClientId;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;
signIn.useClientIDForURLScheme = YES;
and then change your target->info->url types->url schemes property to the dot reverse of your client id.
eg
client id = 2299995859-8gt63glaqk4o8l3ouge3nf1qb2h1vyg3.apps.googleusercontent.com
url schema = com.googleusercontent.apps.2299995859-8gt63glaqk4o8l3ouge3nf1qb2h1vyg3
回答2:
This may have to do with running in Simulator vs actual Device! Trying to confirm, but this is what it looks like at least right now as I get completely different and much better behavior.
来源:https://stackoverflow.com/questions/22270662/invalid-parameter-value-for-redirect-uri