You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my case I have another error appearing after validating the scopes hand check.
with:
OAuth.authorize('google',{scopes: 'profile+email'}).then((oauthCredit:Object):void=>{console.log(oauthCredit);// <-- status 'ok', the token is received.consttoken:string=oauthCredit.response.credentials.accessToken;consturl:string='https://www.googleapis.com/oauth2/v1/userinfo';//const url:string = 'https://www.googleapis.com/plus/v1/people/me'; // <-- either with this WS and without parametersOAuth.makeRequest('google',url,{method : 'get',params : {alt : 'json',access_token : token}}).then((rep:Object):void=>{console.log(rep);// <-- crash before arriving here});});
Everything works fine on iOS simulator but on the device I've got in XCode logs: { status: 'error', msg: 'The operation couldn’t be completed. (NSURLErrorDomain error -1012.)' }
Is anyone facing the same issue?
Ok I fixed that issue, the : NSURLErrorDomain error -1012 mean error 401, when the scopes get updates (one scope more or one scope less) the token is invalidated, it needs to be reseted and assigned again.
Reacted by aadhilakshmi, pratik-logistic, Vishal Dodiya, Sergiy Morenets, loucadufault and Bobby Axe
On 10 Feb 2017, at 11:35, EL YOUBI ***@***.***> wrote:
Couldn't make this work on android, invalid_scope error
manager.authorize('google', {scopes: 'email,profile'})
.then(resp => console.log(resp))
.catch(err => console.log(err));
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Reacted by Shalin LK, Taylor Cooney, Artiom and Aarón Cervantes
neither {scopes: 'email+profile'} nor {scopes: 'email,profile'} nor {scopes: 'email profile'} worked for me. Though doing just {scopes: 'email'} or {scopes: 'profile'} did work for me.
Not sure if someone has a better solution or a newer fork, but here's what seemed to work for me:
TL;DR For android use the rawScopes: "true" in your config and use space as the delimiter, for iOS use + as the delimiter. Note that for the android config, "true" is a string not a boolean.
Make sure you have the right scopes enabled in the project. For e.g., to get https://www.googleapis.com/auth/userinfo.email you need to enable https://console.cloud.google.com/apis/library/script.googleapis.com
Reacted by Christopher Gillis and Kit Tang (KitKat.meow)
you can also use the scopes in this way.
create a route like this and pass in the parameters in the passport.authenticate middleware
router.get('/users/auth/google',passport.authenticate('google',{scope:['profile','email']}));
Activity
BricePissard commentedon Feb 9, 2017
Maybe setting the credential's scopes into fully qualified URL separated by '+' will work for you:
In my case I have another error appearing after validating the scopes hand check.
with:
Everything works fine on iOS simulator but on the device I've got in XCode logs:
{ status: 'error', msg: 'The operation couldn’t be completed. (NSURLErrorDomain error -1012.)' }
Is anyone facing the same issue?
Ok I fixed that issue, the : NSURLErrorDomain error -1012 mean error 401, when the scopes get updates (one scope more or one scope less) the token is invalidated, it needs to be reseted and assigned again.
youbiak commentedon Feb 10, 2017
Couldn't make this work on android,
invalid_scopeerrormartinlockett commentedon Feb 10, 2017
buskerone commentedon Mar 2, 2017
For me it works with {scopes: 'email+profile'}.
filiphosko commentedon Mar 7, 2017
{scopes: 'email profile'} didn't work, {scopes: 'email+profile'} worked. Thanks @buskerone
gvillenave commentedon Jun 13, 2017
Submitted #121 for this issue
SirNeuman commentedon Jun 16, 2017
neither {scopes: 'email+profile'} nor {scopes: 'email,profile'} nor {scopes: 'email profile'} worked for me. Though doing just {scopes: 'email'} or {scopes: 'profile'} did work for me.
darkmantle commentedon Aug 2, 2017
I am getting this error too, no matter what I use as a delimiter. Single scopes work fine but that is no help to me.
maxlang commentedon Mar 2, 2018
Not sure if someone has a better solution or a newer fork, but here's what seemed to work for me:
TL;DR For android use the
rawScopes: "true"in your config and use space as the delimiter, for iOS use+as the delimiter. Note that for the android config,"true"is a string not a boolean.haotangio commentedon May 12, 2018
@maxlang The error on Android while using
"react-native-oauth": "^2.2.0". Do you encounter it?maxlang commentedon May 14, 2018
@haotangio I did originally, but worked around it using the code above. Did you try using
rawScopes: 'true'?As for version, I'm actually using https://github.com/exentrich/react-native-oauth to work around some other issues I was having, but the android code should be the same I think.
haotangio commentedon May 17, 2018
@maxlang I did try
rawScopes: 'true'before posting the previous comment.However, the issue was still there.
maxlang commentedon May 22, 2018
Ok, it looks like the change to support rawScopes was never officially "released" as a version.
Try the following:
This should update you to master.
Make sure
rawScopesappears in.../node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerProviders.javaas it does here: https://github.com/fullstackreact/react-native-oauth/blob/master/android/src/main/java/io/fullstack/oauth/OAuthManagerProviders.java#L271haotangio commentedon May 23, 2018
@maxlang Thank you so much for your information. I will try soon. I guess it will work.
CaelumF commentedon Dec 15, 2021
Leaving it here for the Google Search ™️ users:
https://developers.google.com/identity/protocols/oauth2/scopes
Make sure you have the right scopes enabled in the project. For e.g., to get
https://www.googleapis.com/auth/userinfo.emailyou need to enablehttps://console.cloud.google.com/apis/library/script.googleapis.comhashmatjibran commentedon Jul 15, 2023
you can also use the scopes in this way.
create a route like this and pass in the parameters in the passport.authenticate middleware
router.get('/users/auth/google',passport.authenticate('google',{scope:['profile','email']}));