How to authenticate users only once ?

27 views
Skip to first unread message

Kaushik Komanduri

unread,
Aug 2, 2021, 5:47:29 AM8/2/21
to AdWords API and Google Ads API Forum
The web application that we are building would need the user to authenticate himself over Google Ads, so that only the accounts accessible for him will be fetched and processed. Hence when the user hits the application url, the oauth page comes, where he logs in and allows access for our application. This will be a one time activity and then every time the user accesses the application url, since the auth token is already available in the request params, the user will not be asked to authenticate again, instead he will be automatically redirected to the main page of our application. We were able to enable this feature in our previous project, where we had used Adwords API, but using Google Ads API, we are unable to fix this issue.
This is the code that we are having : 
UserAuthorizer userAuthorizer = UserAuthorizer.newBuilder()
              .setClientId(
                  ClientId.of(adwordsProperties.getClientId(), adwordsProperties.getClientSecret()))
              .setScopes(Arrays.asList(adwordsProperties.getScope()))
              .setTokenStore(new MemoryTokensStorage())
              .setCallbackUri(URI.create(callbackUrl)).build();
We have chosen the web app flow and here is the request URL been created : 

In our previous application using Adwords API, we had implemented the same flow and there was no oAuth request created for every hit.
We are trying to find out what it is that we are missing in our authentication process, due to which the user is prompted to go through oauth every time the application url is accessed.

Google Ads API Forum Advisor

unread,
Aug 2, 2021, 1:21:02 PM8/2/21
to adwor...@googlegroups.com
Hi Kaushik,

Thank you for reaching out to us with the questions about this. From what I understand, you need to get authentication for access to the user's account upon logging into your application. Looking over what you have sent us, let me first start by saying this would appear to be an issue that is more handled by the Cloud Support Team. Thus suggesting to contact them to see what they can offer with respect to that.

At the same time, we would also suggest checking out this link . Which from what we could tell, appears to offer the same solution as you mentioned for adWord.

Regards,

Google Logo
William Pescherine
Google Ads API Team
 


ref:_00D1U1174p._5004Q2LUKch:ref
Reply all
Reply to author
Forward
0 new messages