def get_with_user_credential(user_cred, resource = nil)
      logger.verbose('TokenRequest getting token with user credential ' \
                     "#{user_cred} and resource #{resource}.")
      oauth = if user_cred.is_a? UserIdentifier
                lambda do
                  fail UserCredentialError,
                       'UserIdentifier can only be used once there is a ' \
                       'matching token in the cache.'
                end
              end || -> {}
      request(user_cred.request_params.merge(RESOURCE => resource), &oauth)
    end
def get_with_user_credential(user_cred, resource = nil)
      logger.verbose('TokenRequest getting token with user credential ' \
                     "#{user_cred} and resource #{resource}.")
      oauth = if user_cred.is_a? UserIdentifier
                lambda do
                  fail UserCredentialError,
                       'UserIdentifier can only be used once there is a ' \
                       'matching token in the cache.'
                end
              end || -> {}
      request(user_cred.request_params.merge(RESOURCE => resource), &oauth)
    end
Gets a token based on possessing the users credentials.

 @param UserCredential|UserIdentifier user_cred
   Something that can be used to verify the user. Typically a username
   and password. If it is a UserIdentifier, only the cache will be checked.
   If a matching token is not there, it will fail.
 @optional String resource
   The resource for which the requested access token will provide access.
 @return TokenResponse