Skip to content

State not equal in request and response #458

Open
@mooyg

Description

@mooyg

Getting an error oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response

@router.get("/github", response_class=RedirectResponse)
async def github():
    authorization_url, state = github_oauth.authorization_url(authorization_base_url)
    return authorization_url


@router.get("/callback")
async def authorize(code: str):
    github_oauth.fetch_token(
        token_url, client_secret=client_secret, authorization_response=code
    )
    r = github_oauth.get("https://api.github.com/user")
but when I log state inside `github` function it logs same as in the query param `state` of the callback url

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions