hangupsjs icon indicating copy to clipboard operation
hangupsjs copied to clipboard

Not authorized to request the scopes

Open synle opened this issue 8 years ago • 13 comments

I got this error trying to set up the oauth

400. That’s an error.

Error: invalid_scope

Not authorized to request the scopes: [https://www.google.com/accounts/OAuthLogin]

Learn more

Request Details
That’s all we know.

2017-04-11 07_43_49-error 400 oauth2 error 1

synle avatar Apr 11 '17 14:04 synle

We have updated this in the YakYak app some time ago, but not in hangupsjs itself :\

I'm not really sure on this.. @davibe ?

My workaround is to start a session with YakYak and then copy Cookies, cookies.json and refreshtoken.txt to hangupsjs folder

averissimo avatar Apr 13 '17 18:04 averissimo

@averissimo hello! I'm kind of new to node.js and OAuth. I can't seem to get the constructors to be happy setting it to read from the CookieJar. May I ask if you don't mind sharing your code that let's you read the files from YakYak? I would greatly appreciate it!

dosmage avatar Apr 14 '17 17:04 dosmage

@dosmage

https://github.com/averissimo/hangupsjs/tree/my_blank_login

I use this code to test some stuff, see src/login.coffee..

To get the right scope files:

  • I have yakyak installed, and run it once with the credentials for an account
  • copy ~/.config/yakyak[Cookies,cookies.json,refreshtoken.txt] to the hangupsjs root directory
  • return to hangupsjs root directory
  • run gulp

ps. I use some stuff inside login to send 'Hello World' messages to specific conversations and check for user presence (all depending on the login user)... you can use that code as inspiration

averissimo avatar Apr 18 '17 18:04 averissimo

Hi you said it is fixed in yakyak? Where do you the login in YakYak?

MTRNord avatar May 21 '17 17:05 MTRNord

Got same error. What else scopes we can try? I tried https://www.googleapis.com/auth/plus.login scope... the response

2017-07-22 12:05:42 DEBUG requesting refresh token 2017-07-22 12:05:42 DEBUG auth with code success 2017-07-22 12:05:42 DEBUG attempt to get session cookies ya29.GmCQBIm5oHiERSQPIj3-TRttWGEh07yKamTZZGoZKlkbEDjGhCtW4fxuXXL_15ZqxKCUECIBtf9Pn0jlU05zVCczUC4UV9U1e0cJiaTjivrU3ftnIOTrnHWWz8hIMwExb0k 2017-07-22 12:05:42 DEBUG requesting uberauth 2017-07-22 12:05:43 ERROR getAuth failed { [Error: Forbidden] code: 403, message: 'Forbidden', body: 'Error=badauth\n' } 2017-07-22 12:05:43 DEBUG emit connect_failed { [Error: Forbidden] code: 403, message: 'Forbidden', body: 'Error=badauth\n' }

/Users/max/projects/js/node_modules/q/q.js:155 throw e; ^ Error: Forbidden

It is because of the wrong scope?

Makhlab avatar Jul 22 '17 09:07 Makhlab

Check this: https://productforums.google.com/forum/#!topic/hangouts/LU2YZNDhN_s

The necessary authentication endpoint must be changed to programmatic_auth, the caveat is that the code does not appear directly in the page, it must be retrieved by inpector :\

I've just tested the code below, it should work using the workaround described in the link/video

https://github.com/yakyak/yakyak/blob/master/src/login.coffee#L7

OAUTH2_CLIENT_ID     = '936475272427.apps.googleusercontent.com'
OAUTH2_CLIENT_SECRET = 'KWsJlkaMn1jGLxQpWxMnOox-'

OAUTH2_SCOPE         = 'https://www.google.com/accounts/OAuthLogin https://www.googleapis.com/auth/userinfo.email'

OAUTH2_DELEGATED_CLIENT_ID = '183697946088-m3jnlsqshjhh5lbvg05k46q1k4qqtrgn.apps.googleusercontent.com'

OAUTH2_PARAMS =
    hl: 'en'
    scope: OAUTH2_SCOPE
    client_id:    OAUTH2_CLIENT_ID
    access_type: 'offline'
    delegated_client_id: OAUTH2_DELEGATED_CLIENT_ID
    top_level_cookie: '1'

OAUTH2_QUERY = ("&#{k}=#{encodeURIComponent(v)}" for k, v of OAUTH2_PARAMS).join('')
OAUTH2_LOGIN_URL = "https://accounts.google.com/o/oauth2/programmatic_auth?#{OAUTH2_QUERY}"
OAUTH2_TOKEN_REQUEST_URL = 'https://accounts.google.com/o/oauth2/token'

averissimo avatar Jul 24 '17 22:07 averissimo

or see branch scope_workaround for a working example

averissimo avatar Jul 24 '17 23:07 averissimo

@averissimo Branch scope_workaround does not work for me. I see the URL with "programmatic_auth" instead of "auth", but when opened it asks my password and then hangs indefinitely with "One moment please..."

lorenzos avatar Feb 09 '18 14:02 lorenzos

Got same error. What else scopes we can try? I tried https://www.googleapis.com/auth/plus.login scope... the response

2017-07-22 12:05:42 DEBUG requesting refresh token 2017-07-22 12:05:42 DEBUG auth with code success 2017-07-22 12:05:42 DEBUG attempt to get session cookies ya29.GmCQBIm5oHiERSQPIj3-TRttWGEh07yKamTZZGoZKlkbEDjGhCtW4fxuXXL_15ZqxKCUECIBtf9Pn0jlU05zVCczUC4UV9U1e0cJiaTjivrU3ftnIOTrnHWWz8hIMwExb0k 2017-07-22 12:05:42 DEBUG requesting uberauth 2017-07-22 12:05:43 ERROR getAuth failed { [Error: Forbidden] code: 403, message: 'Forbidden', body: 'Error=badauth\n' } 2017-07-22 12:05:43 DEBUG emit connect_failed { [Error: Forbidden] code: 403, message: 'Forbidden', body: 'Error=badauth\n' } /Users/max/projects/js/node_modules/q/q.js:155 throw e; ^ Error: Forbidden

It is because of the wrong scope?

Any information about this? I'm facing this since couple of days and can't find any information.

lorddrak avatar Jun 19 '20 18:06 lorddrak

Are you using version 1.5.7 or above?

averissimo avatar Jun 21 '20 14:06 averissimo

I'm using 1.3.8 and getting this:

2020-06-21 22:30:00 WARN no init data for apikey 2020-06-21 22:30:00 WARN no init data for email 2020-06-21 22:30:00 WARN no init data for headerdate 2020-06-21 22:30:00 WARN no init data for headerversion 2020-06-21 22:30:00 WARN no init data for headerid 2020-06-21 22:30:00 WARN no init data for timestamp 2020-06-21 22:30:00 WARN no init data for self_entity 2020-06-21 22:30:00 WARN no init data for conv_states { "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } }

I'm using the token mentioned earlier, not sure what has changed. Updating it won't do the trick.

Undrium avatar Jun 21 '20 20:06 Undrium

I'm using lastest version of git "npm install https://github.com/yakyak/hangupsjs.git" after that I needed to auth again and everything works again

lorddrak avatar Jun 22 '20 00:06 lorddrak

@Undrium sorry, I thought I was in the yakyak app context. You can use the code from github, but I'll ask the person with npm permissions to bump the new version.

@davibe can you push a new version (1.3.9) to npm ?

averissimo avatar Jun 22 '20 13:06 averissimo