go - Google Service Account permission denied gmail pub/sub Golang -
trying create application updates links in domains emails. have got service account element working, , can retrieve email accounts in domain on google apps.
so with
config, err := google.jwtconfigfromjson(data, "https://www.googleapis.com/auth/admin.directory.user", "https://www.googleapis.com/auth/gmail.readonly") i create new admin object, , srv.users.list() giving me users.
i want start watch on each account gmail can push emails app.
to this, need access token , impersonate email address of account want start watch on.
ctx := context.background() tokensource := config.tokensource(ctx) token, err := tokensource.token() where config comes jwtconfigfromjson earlier.
it attemps make watch request, error googleapi: error 403: insufficient permission, insufficientpermissions
first issue: i'm not sure can token this, have have seperate oauth config , use token? (that surely require user interaction).
second issue: suspect have not set correct permissions, in either code, or in service account, i'm not sure should be
last issue: in jwtconfigfromjson call, when remove gmail scope, it gets token. when put "unauthorized client or scope in request."
any appreciated! thanks
Comments
Post a Comment