lundi 5 octobre 2015

Single Sign On using Devise

I am trying to use Single sign on in my application. I am referring this link for the implementation.

As per their implementation, they have two different application

  • Provider (used devise for the sign up/in)
  • Client (without devise)

and it is working fine. I am able to login and logout.

Now I am trying to implement same scenario in my applications. I have following application (They are already built and used devise for sign in / up)

  • Provider (used devise for the sign up/in)
  • Client (used devise)

I kept that Provider application as it is (As per the provider.)

But when I tried to implement this in my client getting following error

Could not find devise mapping for path "/auth/sso/callback?code=c6fb99e3d8c6c2545f5a99c6385d7e76&response_type=code&state=7e33b2653946fc3c896e3b8091cfd17c0d6ddd5cfafd16c4".

For this I made following changes

omniauth.rb

APP_ID = 'refe123456789'
APP_SECRET = 'refer123456789'

CUSTOM_PROVIDER_URL = 'http://localhost:3000'

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :sso, APP_ID, APP_SECRET
end

routes.rb

devise_for :users, :controllers => {:sessions => "sessions"}

  # omniauth
  get '/auth/:provider/callback' => 'sessions#create'
  get '/auth/failure' => 'sessions#failure'

Gemfile

gem 'omniauth'
gem 'omniauth-oauth2'

How can I resolve this issue.

Aucun commentaire:

Enregistrer un commentaire