stf icon indicating copy to clipboard operation
stf copied to clipboard

google auth login with error

Open luoxi5017 opened this issue 6 years ago • 4 comments

Anyone can help me to see this issue? I am investigate and blocked here a long time, thank you very much.

Question: I want to use google auth login, my start command is following, when it started, I request to http://a.com:7100 (a.com is I use host to map, 127.0.0.1 to a.com), it will let me use google to account login, after I login, it said the following error: Bad Request.

stf local --auth-type oauth2 --auth-options '["--oauth-authorization-url",
        "https://accounts.google.com/o/oauth2/auth",
        "--oauth-token-url","https://accounts.google.com/o/oauth2/token",
        "--oauth-userinfo-url", "https://www.googleapis.com/oauth2/userinfo",
        "--oauth-client-id","XXXX.apps.googleusercontent.com",
        "--oauth-client-secret","XXXX","--oauth-callback-url",
        "http://a.com:7100/auth/oauth/callback",
        "--oauth-scope","openid email"]'

Exception:

TokenError: Bad Request
    at Strategy.OAuth2Strategy.parseErrorResponse (/workspace/stf/node_modules/passport-oauth2/lib/strategy.js:358:12)
    at Strategy.OAuth2Strategy._createOAuthError (/workspace/stf/node_modules/passport-oauth2/lib/strategy.js:405:16)
    at /workspace/stf/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /workspace/stf/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/workspace/stf/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/workspace/stf/node_modules/oauth/lib/oauth2.js:157:7)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
[object Object]

luoxi5017 avatar Jun 18 '20 09:06 luoxi5017

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.71. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jun 18 '20 09:06 issue-label-bot[bot]

@luoxi001713 did you find a solution? If so please share it. Maybe someone else will have the same issue in the future.

koral-- avatar Jul 03 '20 09:07 koral--

@luoxi001713 did you find a solution? If so please share it. Maybe someone else will have the same issue in the future.

@koral-- yes, using the following command start ok, I don't find the difference from using the parameters, but it does worked.

export OAUTH_AUTHORIZATION_URL=https://accounts.google.com/o/oauth2/v2/auth export OAUTH_TOKEN_URL=https://www.googleapis.com/oauth2/v4/token export OAUTH_USERINFO_URL=https://www.googleapis.com/oauth2/v3/userinfo export OAUTH_CLIENT_ID=XXXXXXXXXXX.apps.googleusercontent.com export OAUTH_CLIENT_SECRET=XXXXXXX export OAUTH_CALLBACK_URL=http://MyDomain.com:7100/auth/oauth/callback export OAUTH_SCOPE="openid email"

./stf local --public-ip MyDomain --allow-remote --auth-type oauth2

luoxi5017 avatar Jul 03 '20 09:07 luoxi5017

Hi @luoxi001713 .when you login google authen, can you login with admin right?

linhvv12 avatar Aug 23 '22 04:08 linhvv12