code: @SuppressWarnings("deprecation")
    public Credential createAndStoreCredential(TokenResponse response, String userId)
        throws IOException {
      Credential credential = newCredential(userId).setFromTokenResponse(response);
      if (credentialStore != null) {
        credentialStore.store(userId, credential);
      }
      if (credentialDataStore != null) {
        credentialDataStore.set(userId, new StoredCredential(credential));
      }
      if (credentialCreatedListener != null) {
        credentialCreatedListener.onCredentialCreated(credential, response);
      }
      return credential;
    }
docs: Creates a new credential for the given user ID based on the given token response
  and stores it in the credential store.
  
  @param response token response
  @param userId user ID or {@code null} if not using a persisted credential store
  @return newly created credential