Hi,

I have a python app I want to deploy on App Engine (2nd Generation Python 
3.7) on which I use a Service Account with Domain-wide delegation enabled 
to access user data.


Locally I do:

import google.authfrom apiclient.discovery import build

creds, project = google.auth.default(
    scopes=['https://www.googleapis.com/auth/admin.directory.user', ],)
creds = creds.with_subject(GSUITE_ADMIN_USER)

service = build('admin', 'directory_v1', credentials=creds)

This works good and, as far as I know it is the *current* way to do this 
when using Application Default Credentials (locally I have 
GOOGLE_APPLICATION_CREDENTIALS defined).


Problem is on GAE, when deployed, the call to with_subject raises: 
AttributeError: 
'Credentials' object has no attribute 'with_subject'

I have enabled Domain-wide delegation on the GAE service account already.


What is different between the GOOGLE_APPLICATION_CREDENTIALS I use locally 
and the ones in GAE when both are service accounts with domain-wide 
delegation?


Where is .with_subject() on GAE?


The creds object received is of type compute_engine.credentials.Credentials.


Thanks for the help,

Marc


PS: This is cross posted from StackOverflow, sadly could not get any help 
there in the past two days on this problem. [link] 
<https://stackoverflow.com/questions/53202767/gae-attributeerror-credentials-object-has-no-attribute-with-subject>
PSS: Please add python37 as a suggested tag on the group!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/56c9ccb1-a501-44d1-bd70-0a82d105b055%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... Marc Fargas

Reply via email to