added scope
This commit is contained in:
@@ -253,16 +253,10 @@ def do_refresh_token(refreshtoken):
|
||||
# headers=headers)
|
||||
|
||||
prepped = req.prepare()
|
||||
print prepped.body
|
||||
prepped.body+="&scope="
|
||||
prepped.body+=scope
|
||||
|
||||
print prepped.body
|
||||
|
||||
response = s.send(prepped)
|
||||
print response.status_code
|
||||
|
||||
print response
|
||||
token_json = response.json()
|
||||
try:
|
||||
thetoken = token_json['access_token']
|
||||
@@ -286,15 +280,25 @@ def get_token(code):
|
||||
client_auth = requests.auth.HTTPBasicAuth(C2_CLIENT_ID, C2_CLIENT_SECRET)
|
||||
post_data = {"grant_type": "authorization_code",
|
||||
"code": code,
|
||||
"scope": scope,
|
||||
# "scope": scope,
|
||||
"redirect_uri": C2_REDIRECT_URI,
|
||||
"client_secret": C2_CLIENT_SECRET,
|
||||
"client_id":C2_CLIENT_ID,
|
||||
}
|
||||
headers = {'user-agent': 'sanderroosendaal'}
|
||||
response = requests.post("https://log.concept2.com/oauth/access_token",
|
||||
data=post_data,
|
||||
headers=headers)
|
||||
url = "https://log.concept2.com/oauth/access_token"
|
||||
s = Session()
|
||||
req = Request('POST',url, data=post_data, headers=headers)
|
||||
|
||||
prepped = req.prepare()
|
||||
prepped.body+="&scope="
|
||||
prepped.body+=scope
|
||||
|
||||
response = s.send(prepped)
|
||||
|
||||
# response = requests.post("https://log.concept2.com/oauth/access_token",
|
||||
# data=post_data,
|
||||
# headers=headers)
|
||||
token_json = response.json()
|
||||
thetoken = token_json['access_token']
|
||||
expires_in = token_json['expires_in']
|
||||
@@ -314,8 +318,6 @@ def make_authorization_url(request):
|
||||
"redirect_uri": REDIRECT_URI}
|
||||
url = "https://log.concept2.com/oauth/authorize?"+ urllib.urlencode(params)
|
||||
url += "&scope="+scope
|
||||
print url
|
||||
# url = "https://ssl.reddit.com/api/v1/authorize?" + urllib.urlencode(params)
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user