Ameerkhan
Ameerkhan

Reputation: 26

How to access users mailbox using admin access token

I got access token for admin user. Now I have to use gmail api to retrieve users gmail metadata of my domain as usual like REST api.

Ex: https://www.googleapis.com/gmail/v1/users/me/threads?access_token=user_access_token

Now I have to get same user threads by using admin token

https://www.googleapis.com/gmail/v1/users/user_id/threads?access_token=admin_access_token>

Am i doing this in correct way or suggest me the best way to sort out this issue.

Upvotes: 0

Views: 339

Answers (1)

Richie Foreman
Richie Foreman

Reputation: 342

I would strongly suggest leveraging an OAuth2 Service Account (Signed JWT). When properly configured, you can specify a 'sub' parameter as any user within your domain.

Upvotes: 1

Related Questions