adla praveen
adla praveen

Reputation: 161

How to identify allowed user google calendar api authorization request gmail account

I need to find the user response for authorised request in identification to his gmail account, Actually am trying to send mail regarding the authentication from developers account to users. When user clicks Allow then calendar events are created in their calendar.

But when they deny, Exception pops out stating Not authorised user. I need to find the user mail id and what user doing accepting or denying ? Yeah I tried this link

Example :

https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=ya29.Ci82A9-AcdxxjkatYj5NxwaxmJJybeOq7JwqhBUOCYpFM9xpBKHrWlEVULea4OfM_Q

but i am getting error:

   {
     "error": {
     "errors": [
        {
          "domain": "global",
          "reason":  "insufficientPermissions",
          "message": "Insufficient Permission"
        }
        ],
      "code": 403,
      "message": "Insufficient Permission"
    }
  }

Need Assistance Guys.

Upvotes: 0

Views: 530

Answers (2)

some1
some1

Reputation: 867

How did you get the above access_token "ya29.Ci82A9-AcdxxjkatYj5NxwaxmJJybeOq7JwqhBUOCYpFM9xpBKHrWlEVULea4OfM_Q" at the first place?

If you provide the proper auth scope and add along "email" (perhaps also "profile" or "openid") in the scope string, you will be able to retrieve the authenticated user's email address (and other profile/openid details).

Anyway, I suspect the issue you encountered is due to the incorrect scope being specified.

https://developers.google.com/identity/protocols/OpenIDConnect

Upvotes: 1

Related Questions