I need a push on this one. Now that I know how to properly Authenticate,
also retrieve the code and the access_token which in turn is the same one
used to refresh_token, how can I put everything together? I need to check
whether the token is expired ( I am thinking a session) and if it is,
authentication needs to happen again. So, all in all I have these pieces of
code (they all work as far as I know):
*Authenticate:*
params = {"response_type": "code",
"client_id": CLIENT_ID,
"scope": "employee:customers_read"}
url = "https://jimbaroo.com/oauth/authorize.php?" +
urllib.urlencode(params)
return dict(url=url)Enter code here...
*Get Access_token:*
code = current.request.vars.code
payload = {"client_id":CLIENT_ID,
"client_secret":CLIENT_SECRET,
"code":code,
"grant_type":"authorization_code"}
url="https://jimbaroo.com/oauth/access_token.php"
r = requests.request("POST",url, data=payload)
token = r.json()
access_token = token['access_token']
current.session.token = access_token
*Refresh:*
refresh_token_request =
requests.get('https://jimbaroo.com/oauth/access_token.php',
data=payload).json()
payload = {
"refresh_token":current.session.token,
"client_secret":CLIENT_SECRET,
"client_id":CLIENT_ID,
"grant_type":"refresh_token"
}
thanks appreciated
On Wednesday, March 7, 2018 at 6:04:15 PM UTC-8, greenpoise wrote:
>
> Hi Dave, thanks for the input. I was able to post the temporary code and
> get an authentication code. I will post tomorrow my updated code. I feel i
> am close. Thanks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.