0
votes

I am following the documentation provided by google to access gmail using API. According to the google documentation we need access token to manage gmail.

So I tried to create an access token by reading this documentation links given below.

Link1 :- developers.google.com/accounts/docs/OAuth2WebServer, created URL1 based on this document.

Link2 :- code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough, created URL2 based on this document.

URL1 :- https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=%2Fprofile&redirect_uri=http%3A%2F%2Flocalhost%2Fstudy%2Fgmail-access%2Foauth2-php-samples%2Foauth2.php&response_type=code&client_id=XXXXXXXXXXXXXXX.apps.googleusercontent.com&approval_prompt=force

URL2 :- https://accounts.google.com/o/oauth2/auth?client_id=XXXXXXXXXX.XXXXapXps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%2Fstudy%2Fgmail-access%2Foauth2-php-samples%2Foauth2.php&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F

I am getting the invalid client response in both requests. Please help me to find the reason of getting the invalid client response.

1

1 Answers

0
votes

I am not sure about the issue with URL1 but token is getting correctly after replacing the redirect uri and client id

URL2 was incorrect because I used the client id of web applications instead of installed applications.

As far as I know the instructions in https://code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough help to make token for installed application not web application.