| Module | Oauth::Models::Consumers::Token::ClassMethods |
| In: |
lib/oauth/models/consumers/token.rb
|
Finds, creates or updates a ConsumerToken by finding the token or taking it when it‘s given. It then updates the attributes and saves the changes/new record to a datastore. @param user [User] The user to which the access token should belong to @param access_token [AccessToken || Oauth2Token] Either a request token taken from the service or a ConsumerToken @param new_token [AccessToken] A new access token, used for refreshing the access token with OAuth 2.
Usage example: find_or_create_from_access_token(current_user, access_token) <— Find or create a new access token find_or_create_from_access-token(current_user, Oauth2Token.last, client.refresh!) <— Edits existing record with new refreshed information
Set the details such as the secret, refresh token and expiration time to an instance of ConsumerToken @return [ConsumerToken] A ConsumerToken