connor_lough
11/08/2022, 11:35 PMtap-asana users...
How did y'all get the refresh token from Asana?ruslan_bergenov
11/22/2022, 5:33 PMimport asana
import requests
client = asana.Client.oauth(
client_id='CLIENT_ID',
client_secret='CLIENT_SECRET',
redirect_uri='urn:ietf:wg:oauth:2.0:oob'
)
# Run to get authorization
(url, state) = client.session.authorization_url()
print(url)
response = requests.get(url)
print(response)
You should see a URL with a 200 response code. Now Navigate to the URL provided and authorize your application. You’ll then be redirected to a page with an authorization code. With your authorization code, now run the following script:
import asana
import requests
client = asana.Client.oauth(
client_id='CLIENT_ID',
client_secret='CLIENT_SECRET',
redirect_uri='urn:ietf:wg:oauth:2.0:oob'
)
# Run to get Refresh Token
code = 'INSERT AUTH CODE HERE'
token = client.session.fetch_token(code=code)
print(token['refresh_token'])
Now you should have the refresh token for the configuration