File size: 392 Bytes
027a338
3cd8a78
 
027a338
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import google_auth_oauthlib.flow


def get_oauth_url(SCOPES, redirect_url):
    flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(
        "credentials.json", scopes=SCOPES
    )

    flow.redirect_uri = redirect_url

    authorization_url, state = flow.authorization_url(
        access_type="offline",
        include_granted_scopes="true",
    )

    return authorization_url