I created a project with Gmail API. For this project I set OAuth Client Id and Consent Screen with default params. For OAuth Client Id definition I have the following settings:
- I set authorized origins (with and without www)
- I set redirections URLs (with and without www)
In KTA, I access Integration > OAuth 2.0 Servers and add a new server. Using the information from google console i pass the correct information provided (I guess):
- grant type is Authorization Code
- authentication method is secret in post body (i also tried other options) like secret using basic authentication
- i passed access token url, scope and authorization URI
- the redirect URL is the one i set for my OAuth Client ID in google console
I tried to click on Authorize and it opened once a window asking me to authorize the application. After this I save the OAuth configuration.
I do obtain an error message telling that i can't obtain actualization token.
In KTA, I access import settings and add a new import source. I choose IMAP, setting host information, the Port and username. I also select the OAuth server after selecting Use OAuth Server option.
My issue happens when I try mailbox (Test mailbox). I obtain an error message.
I also added 2 query parameters:
- access_type=offline
- approval_prompt=force
I also tried to check what was sent during authorization process with KTA. I just consulted my network tools in Chrome. When authorize is clicked a query is set to UpdateOAuthServer. I note that I do get an authorization code. this code is returned by google if i'm right.
Finally, I tried to get token using postman. For this i just called an entry point from Gmail API:
https://gmail.googleapis.com/gmail/v1/users/me/messages
And i passed the same parameters for authorization:
I do obtain a token, and i can use the entry point.
I'm actually stucked trying to find how to solve this issue. I may have wrong settings in my my OAuth settings in Google console or even in Kofax Total Agility. I've spent a whole day learning how to use OAuth2 with gmail and Office 365. I'm still getting the issue here while the same settings are working with Postman.