alxd commited on
Commit
1104e14
·
1 Parent(s): 10b8a2d

gmail api auth

Browse files
Files changed (1) hide show
  1. scoutLLM.py +10 -4
scoutLLM.py CHANGED
@@ -370,15 +370,21 @@ def get_gmail_credentials():
370
  "token_uri": "https://oauth2.googleapis.com/token",
371
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
372
  "client_secret": client_secret,
373
- # Use the correct redirect URI
374
- "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
375
  }
376
  }
377
  flow = InstalledAppFlow.from_client_config(client_config, SCOPES)
378
- auth_url, _ = flow.authorization_url(prompt='consent', access_type='offline')
 
 
 
 
 
 
 
379
 
380
  print("Go to the following URL in your browser:\n", auth_url)
381
- code = input("Enter the authorization code: ").strip() # Ensure no extra spaces
382
  flow.fetch_token(code=code)
383
  creds = flow.credentials
384
 
 
370
  "token_uri": "https://oauth2.googleapis.com/token",
371
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
372
  "client_secret": client_secret,
373
+ "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob"]
 
374
  }
375
  }
376
  flow = InstalledAppFlow.from_client_config(client_config, SCOPES)
377
+
378
+ # Manually construct the URL with redirect_uri
379
+ auth_url, _ = flow.authorization_url(
380
+ prompt='consent',
381
+ access_type='offline',
382
+ include_granted_scopes='true'
383
+ )
384
+ auth_url += "&redirect_uri=urn:ietf:wg:oauth:2.0:oob" # Explicitly add redirect_uri
385
 
386
  print("Go to the following URL in your browser:\n", auth_url)
387
+ code = input("Enter the authorization code: ").strip()
388
  flow.fetch_token(code=code)
389
  creds = flow.credentials
390