Skip to content

Commit

Permalink
Update gdrive.py
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhhu authored Aug 18, 2023
1 parent ba9741d commit a4719ef
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions utilities/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self):
def get_oauth2_url(self):
return "https://accounts.google.com/o/oauth2/v2/auth?" + urlencode({
"client_id": self.client_id,
"redirect_uri": "http://plugins.xditya.me/auth",
"redirect_uri": "https://plugins.xditya.me/auth",
"response_type": "code",
"scope": self.scope,
"access_type": "offline",
Expand Down Expand Up @@ -88,9 +88,6 @@ async def get_access_token(self, code=None) -> dict:
self.creds["expires_in"] = time.time() + 3590
udB.set_key("GDRIVE_AUTH_TOKEN", self.creds)
return self.creds
if code.startswith("http://localhost"):
# get all url arguments
code = parse_qs(code.split("?")[1]).get("code")[0]
resp = await self._session.post("https://oauth2.googleapis.com/token", data={"client_id": self.client_id, "client_secret": self.client_secret, "redirect_uri": "http://localhost", "grant_type": "authorization_code", "code": code}, headers={"Content-Type": "application/x-www-form-urlencoded"})
self.creds = await resp.json()
self.creds["expires_in"] = time.time() + 3590
Expand Down

0 comments on commit a4719ef

Please sign in to comment.