← Back to Upcase

Omniauth with doorkeeper

(Charlieanna ) #1

I am using my own Omniauth by using doorkeeper.I also use devise. The issue is that in the callback I sign_in the user but as soon as I redirect him to the dashboard I get the current_user as nil. Dont know why the cookies/ sessions is getting wiped.

In the callback method after the sign_in method the current_user is not nil but in the dashboard show method the current_user comes as nil.


(Pedro Moreira) #2

@charlieanna1, have you configured Doorkeeper’s resource_owner as instructed here ?

Hope this helps, otherwise I’m sure @Tute_Costa can help you figure this one out :slight_smile:

(Charlieanna ) #3

But this method goes in the provider right. I am unable to get the current user in the client app.

(Charlieanna ) #4

I already use this in the auth server app.

    Doorkeeper.configure do
       orm :active_record
      # This block will be called to check whether the resource owner is authenticated or not.
       resource_owner_authenticator do
        current_user || warden.authenticate!(:scope => :user)

(Pedro Moreira) #5

Ah, you’re right. Have you checked out the example apps for clients? There is an example for devise that might come in handy. Other than that, I don’t think I can help much more.

(Tute Costa) #7

Thanks for poking @pedromoreira.

@charlieanna1 I don’t remember having seen a case like that, it should work. Can you please post your callbacks controller?

(Charlieanna ) #8

I fixed the issue. I was also actually trying to so single sign on because of which I was doing something to the sessions variable and hence the current_user was disappearing.

(Charlieanna ) #9

Another issue. How do I redirect the user back to the client app after he logs in with the provider app? Currently after he logs in he is taken to the provider app dashboard.