def getAccessToken(self, code): response = urlutils.post("https://accounts.google.com/o/oauth2/token", data={ "code": code, "client_id": self.client_id, "client_secret": self.client_secret, "redirect_uri": self.redirect_uri, "grant_type": "authorization_code" }, headers={"Accept": "application/json"}, verify=False) if response.status_code != 200: return None data = response.json() if data is None: return None elif "error" in data: raise auth.Failure(data["error"]) elif "access_token" not in data: return None return data["access_token"]
def getAccessToken(self, code): response = urlutils.post( "https://github.com/login/oauth/access_token", data={"client_id": self.client_id, "client_secret": self.client_secret, "code": code}, headers={"Accept": "application/json"}, ) if response.status_code != 200: return None data = response.json() if data is None: return None elif "error" in data: raise auth.Failure(data["error"]) elif "access_token" not in data: return None return data["access_token"]
def getAccessToken(self, code): response = urlutils.post("https://github.com/login/oauth/access_token", data={ "client_id": self.client_id, "client_secret": self.client_secret, "code": code }, headers={"Accept": "application/json"}) if response.status_code != 200: return None data = response.json() if data is None: return None elif "error" in data: raise auth.Failure(data["error"]) elif "access_token" not in data: return None return data["access_token"]
def getAccessToken(self, code): response = urlutils.post( "https://accounts.google.com/o/oauth2/token", data={ "code": code, "client_id": self.client_id, "client_secret": self.client_secret, "redirect_uri": self.redirect_uri, "grant_type": "authorization_code" }, headers={ "Accept": "application/json" }, verify=False) if response.status_code != 200: return None data = response.json() if data is None: return None elif "error" in data: raise auth.Failure(data["error"]) elif "access_token" not in data: return None return data["access_token"]