Serializing the credential class or creating a new one

25 views
Skip to first unread message

Nils Dussart

unread,
Nov 2, 2012, 7:37:11 PM11/2/12
to google-oauth...@googlegroups.com
Sorry for cross-posting but I think I've used the wrong group.
 
I was reviewing the sampled oauth2-cmdline-sample and was able to call several APIs but I've ran into an issue i'm not able to solve.
 
I'd like to pass my token to another native application that is within my security boundaries. I'd like to serialize the credential class to achieve this if that makes sense or find a way to create a new credential class by passing several information including the token id.
 
Is there an example showing how to create a new credential based on an existing credential class?
 
Thank you for your help,
 
Nils

Yaniv Inbar (יניב ענבר)

unread,
Nov 5, 2012, 7:39:41 AM11/5/12
to google-oauth...@googlegroups.com
There are a number of possible solutions depending on your use case.  One option is to simply pass only the access token (Credential.getAccessToken) to the native application, and when it expires request that the token be refreshed by your main application and a new access token be sent to the native application.

Another approach is for your two applications to share the same storage of the credential store.  See https://code.google.com/p/google-oauth-java-client/wiki/OAuth2#Credential_and_Credential_Store

-- Yaniv
Reply all
Reply to author
Forward
0 new messages