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.



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

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(:"#{self.oauth2_token_field}" => 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)


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

def oauth2_auto_create_account?
  self.
end