private Credential newCredential ( String userId ) { Credential . Builder builder = new Credential . Builder ( getMethod ( ) ) . setTransport ( getTransport ( ) ) . setJsonFactory ( getJsonFactory ( ) ) . setTokenServerEncodedUrl ( getTokenServerEncodedUrl ( ) ) . setClientAuthentication ( getClientAuthentication ( ) ) . setRequestInitializer ( getRequestInitializer ( ) ) . setClock ( getClock ( ) ) ; if ( getCredentialStore ( ) != null ) { builder . addRefreshListener ( new CredentialStoreRefreshListener ( userId , getCredentialStore ( ) ) ) ; } builder . getRefreshListeners ( ) . addAll ( getRefreshListeners ( ) ) ; return builder . build ( ) ; }
Returns a new OAuth 2 . 0 credential instance based on the given user ID .