[Django]-Got InvalidClientIdError (invalid_request) Mismatching redirect URI. using requests_oauthlib

6👍

I figured it out, you need to pass “redirect_uri ” to the OAuth2Session in callback function too. OAuth2Session(client_id, state=state, redirect_uri=redirect_uri**)

2👍

I’m using a different library, but the same method works, by passing the redirect_uri param, which was not in the original example in Google API documentation.

    flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(
    CLIENT_SECRET_FILE,
    scopes=GDRIVE_API_SCOPE,
    state=state,
    redirect_uri=GDRIVE_REDIRECT_URI)

Leave a comment