Class: OAuthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/oauth_callbacks_controller.rb

Overview

OauthCallbacksController authrorizes the user by OAuth providers

Instance Method Summary collapse

Instance Method Details

#authObject


5
6
7
# File 'app/controllers/oauth_callbacks_controller.rb', line 5

def auth
  request.env['omniauth.auth']
end

#authorizeObject


9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/oauth_callbacks_controller.rb', line 9

def authorize
  provider = auth.provider

  user = User.oauth_authorize(auth)
  if user.oauth_authorized?(provider)
    authorized(user, provider)
  else
    unauthorized(provider)
  end
end