What are different ways to create credentials object ?

211 views
Skip to first unread message

ranjith

unread,
Oct 3, 2017, 2:20:13 PM10/3/17
to Google Cloud Developers
Hi,

Can you please list all the different ways get credentials objects

1) using service account
credentials = GoogleCredentials.get_application_default()

2) using access token from sign-in button (gmail username and password login)
credentials = AccessTokenCredentials('access_token', 'user agent')

Any other ways supported ? 

Also step1 generates a JWT accesstoken .. can we use this token to create credentials object back ? 

Thanks,
RJ 

George (Cloud Platform Support)

unread,
Oct 3, 2017, 3:54:11 PM10/3/17
to Google Cloud Developers
Hello Ranjith, 

In fact only option 1) from you example gets credentials. At point 2), a set of credentials is used by means of your copied statement. You have acquired an OAuth 2.0 access_token from another place in that case, such as a JavaScript client or another web application, and wish to use it from Java or Python. 

Other ways supported, in the line of programmatic authentication: through a user account, authenticating from a mobile app,  from a desktop app. You may connect programmatically using a developer account, service account, or mobile app credentials. All these options are described in more detail in the "Programmatic authentication" online document. An extensive Java example is provided on that page, that should help you as well. 
Reply all
Reply to author
Forward
0 new messages