On Monday, March 19, 2018 at 3:58:00 PM UTC-7, Greenpoise wrote:
>
> I feel like I am having a monologue here geez.. ANyways, I sort of figured 
> this one out by going to the Index following the authentication and 
> redirecting to the menu. Eventually the redirect should only work if both 
> Access token and refresh token are received. Anyways, now (hopefully 
> someone will help me on this one), I receive json garble when I try to pull 
> customers data. How do I parse this all nicely in a table form???
>
>
> thanks
>
>

Um, json.loads() ?


I'd have been happy to help you more, but I've already shown how much I 
know, and I'm not sure your usecase is typical OAUTH2 (see my diagram in 
the earlier post).

I think Massimo and niphlod can tell you more about OAUTH2, but with their 
less-regular participation here, you may not get a quick answer from them.  
The other gurus may not have done as much with OAUTH2, which could be why 
they aren't tossing anything in here.

/dps


>
>
> On Thursday, March 15, 2018 at 2:38:08 PM UTC-7, greenpoise wrote:
>>
>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to