Invalid parameter value for redirect_uri

十年热恋 提交于 2021-02-09 09:26:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!