Here are the examples of the java api class com.google.api.client.auth.oauth2.CredentialStore taken from open source projects.
1. AuthorizationFlow#createAndStoreCredential()
Project: android-oauth-client
File: AuthorizationFlow.java
File: AuthorizationFlow.java
/** * Creates a new credential for the given user ID based on the given token * response and store in the credential store. * * @param response implicit authorization token response * @param userId user ID or {@code null} if not using a persisted credential * store * @return newly created credential * @throws IOException */ public Credential createAndStoreCredential(ImplicitResponseUrl implicitResponse, String userId) throws IOException { Credential credential = newCredential(userId).setAccessToken(implicitResponse.getAccessToken()).setExpiresInSeconds(implicitResponse.getExpiresInSeconds()); CredentialStore credentialStore = getCredentialStore(); if (credentialStore != null) { credentialStore.store(userId, credential); } if (credentialCreatedListener != null) { credentialCreatedListener.onCredentialCreated(credential, implicitResponse); } return credential; }
2. AuthorizationFlow#createAndStoreCredential()
Project: android-oauth-client
File: AuthorizationFlow.java
File: AuthorizationFlow.java
/** * Creates a new credential for the given user ID based on the given token * response and store in the credential store. * * @param response OAuth 1.0a authorization token response * @param userId user ID or {@code null} if not using a persisted credential * store * @return newly created credential * @throws IOException */ public OAuthHmacCredential createAndStoreCredential(OAuthCredentialsResponse response, String userId) throws IOException { OAuthHmacCredential credential = new10aCredential(userId).setAccessToken(response.token).setTokenSharedSecret(response.tokenSecret); CredentialStore credentialStore = getCredentialStore(); if (credentialStore != null) { credentialStore.store(userId, credential); } if (credentialCreatedListener != null) { credentialCreatedListener.onCredentialCreated(credential, response); } return credential; }