Module: Devise::Models::Oauth2Authenticatable::ClassMethods

Defined in:
lib/devise_oauth2_authenticatable/model.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_with_oauth2(oauth2_id, oauth2_token) ⇒ Object

Authenticate a user based on OAuth2 UID.



154
155
156
157
158
159
160
161
# File 'lib/devise_oauth2_authenticatable/model.rb', line 154

def authenticate_with_oauth2(oauth2_id, oauth2_token)
  
    # find user and update access token 
    returning(self.find_for_oauth2(oauth2_id)) do |user|
      user.update_attributes(:oauth2_token => oauth2_token) unless user.nil?
    end

end

#oauth2_auto_create_account?Boolean

Alias don’t work for some reason, so…a more Ruby-ish alias for oauth2_auto_create_account.

Returns:

  • (Boolean)


148
149
150
# File 'lib/devise_oauth2_authenticatable/model.rb', line 148

def oauth2_auto_create_account?
  self.
end