Google OAuth 2 and state parameter values need to be registered in redirect url

前端 未结 1 1760
栀梦
栀梦 2021-02-14 07:18

The state parameter according to the Google Oauth 2.0 docs:

Indicates any state which may be useful to your application upon receipt of the response. The

1条回答
  •  太阳男子
    2021-02-14 07:58

    The name of the parameter is state (and not redirect_state)!

    A sample OAuth request according to the google documentations is ->

    https://accounts.google.com/o/oauth2/auth?
    scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&
    state=%2Fprofile&
    redirect_uri=https%3A%2F%2Foauth2-login-demo.appspot.com%2Fcode&
    response_type=code&
    client_id=812741506391.apps.googleusercontent.com&approval_prompt=force
    

    Please note the State parameter and the redirect_uri parameter. I think you've mixed up the two.

    EDIT - See this link by Google. Has good explanation about state parameters and building up the web requests.

    0 讨论(0)
提交回复
热议问题