Hello,

I am putting together a Django web application using the Python client 
library. I would like users to be able to authenticate and then do stuff.

I have built a web flow and it works fine to get the authorization token. I 
then use the auth to get a refresh token as such


### Initiates oauth request
auth_code = request.GET['code'] #Grabs auth code
flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(
os.path.join(os.path.dirname(os.path.dirname(__file__)),'client_secret.json'
),
scopes=[oauth2.GetAPIScope('adwords')])
flow.redirect_uri = 'http://127.0.0.1:8000/data'
authorization_url, state = flow.authorization_url(
access_type='offline',
include_granted_scopes='true')

refresh_token = flow.fetch_token(code=auth_code)
credentials = flow.credentials

client = google.ads.google_ads.client.GoogleAdsClient(
credentials, developer_token)


Now I want to build a client using the refresh token. I am passing it using 
a dict. The token comes back as a string starting with a number and a / 
followed by a bunch of characters.

I am using the same developer token, client_id and client_secret found in 
the client_secret.json file.

    def googleAdsClient(refresh_token, developer_token, client_id, 
client_secret):
       google_credentials = {
       'developer_token': developer_token,
       'refresh_token': refresh_token,
       'client_id': client_id,
       'client_secret': client_secret}
       google_ads_client = 
GoogleAdsClient.load_from_dict(google_credentials)

Every time I try to make this work I get an invalid_grant response.

Am I missing a step or not fully understanding the concept of what I need 
to do to get the client working?

-- 
CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this e-mail in error, please 
delete it from your system. Thank you.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f0c37b3f-e357-4b2f-8e4b-e828258f06e1%40googlegroups.com.

Reply via email to