Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not authorized to request the scopes #70

Open
synle opened this issue Apr 11, 2017 · 13 comments
Open

Not authorized to request the scopes #70

synle opened this issue Apr 11, 2017 · 13 comments

Comments

@synle
Copy link

synle commented Apr 11, 2017

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

@averissimo
Copy link
Member

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

@dosmage
Copy link

dosmage commented Apr 14, 2017

@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!

@averissimo
Copy link
Member

@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

@MTRNord
Copy link

MTRNord commented May 21, 2017

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

@Makhlab
Copy link

Makhlab commented Jul 22, 2017

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?

@averissimo
Copy link
Member

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
Copy link
Member

or see branch scope_workaround for a working example

@lorenzos
Copy link
Contributor

lorenzos commented Feb 9, 2018

@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..."

@lorddrak
Copy link

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.

@averissimo
Copy link
Member

Are you using version 1.5.7 or above?

@Undrium
Copy link

Undrium commented Jun 21, 2020

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.

@lorddrak
Copy link

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

@averissimo
Copy link
Member

@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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants