Class: OmniauthCallbacksController

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

Instance Method Summary collapse

Instance Method Details

#doorkeeperObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/omniauth_callbacks_controller.rb', line 3

def doorkeeper
  oauth_data = request.env["omniauth.auth"]
  @user = User.find_or_create_for_doorkeeper_oauth(oauth_data)
  @user.update_doorkeeper_credentials(oauth_data)
  @user.save
  @user.connect
  if @user.identities.find_by(provider:"github").nil?
    @user.identities.create(provider:"github",auth_token:oauth_data.info.github_auth_token,email:oauth_data.info.github_email) 
  end
   @user
  redirect_to dashboard_path
end