still not working token exchagen
This commit is contained in:
@@ -53,20 +53,30 @@ oauth_data = {
|
||||
'scope':'read',
|
||||
}
|
||||
|
||||
def get_token(code):
|
||||
def get_token(code,callbackuri):
|
||||
#client_id = oauth_data['client_id']
|
||||
#client_secret = oauth_data['client_secret']
|
||||
#base_uri = oauth_data['base_url']
|
||||
|
||||
#callbackuri = 'https://'+callbackuri[9:]
|
||||
#print(callbackuri)
|
||||
|
||||
#nk = OAuth2Session(client_id)
|
||||
#token = nk.fetch_token(base_uri,client_secret=client_secret,authorization_response=callbackuri)
|
||||
|
||||
#print(token)
|
||||
#return [0,0,0]
|
||||
return imports_get_token(code, oauth_data)
|
||||
url = oauth_data['base_url']
|
||||
data = {"client_id": oauth_data['client_id'],
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": oauth_data['redirect_uri'],
|
||||
"client_secret": oauth_data['client_secret'],
|
||||
"code": code,
|
||||
# "scope":oauth_data['scope'],
|
||||
}
|
||||
#url = url+'?'+urllib.parse.urlencode(params)
|
||||
print(url)
|
||||
response = requests.post(url,data=data)
|
||||
print(response.reason)
|
||||
return [0,response.text,0]
|
||||
#return imports_get_token(code, oauth_data)
|
||||
|
||||
def nk_open(user):
|
||||
t = time.localtime()
|
||||
|
||||
Reference in New Issue
Block a user