AlpaBeta
AlpaBeta

Reputation: 1

Get URL with access token

I know this is a question with a really simple answer, but I've been looking for the answer for two hours and I can't find it. I am trying to convert a web.py google and facebook auth login module to a dash app I am creating.

I can't find the code to convert this: code = web.input().get('code')

I need it to retrieve the access token and get user info.

This is the original code: https://github.com/siongui/webpy-oauth/blob/master/auth.py

How can I parse the URL in a dash app to get the code (access token)?

Upvotes: -1

Views: 414

Answers (1)

AlpaBeta
AlpaBeta

Reputation: 1

I already found the answer. You can do it with the dcc.Location function of Dash. Place it somewhere within the layout and in a callback use [Input('url', 'href')] as one of input sources. The href contains the whole URL.

You can after that parse the URL in string format to get the access token with: urllib.parse.parse_qs(url)

Upvotes: 0

Related Questions