Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devise and doorkeeper : how to setup custom login scenario for third party app? #830

Closed
bsylvain opened this issue May 9, 2016 · 4 comments

Comments

@bsylvain
Copy link

bsylvain commented May 9, 2016

I have an app using doorkeeper and devise. I use devise both for direct login in the app and to authenticate users from third party app through doorkeeper.

My problem is that i do not know how to have two controllers handling log in and log in error in the app. The best I can do is to redirect doorkeeper login to a view with a devise login form, but if the user does not login correctly he is redirected to the default devise login page.

Is it possible to have a different set of login page for doorkeeper ? Should i use something else than Devise?

@tute
Copy link
Contributor

tute commented May 9, 2016

The login page creates a session in your app (whether the user will use whatever it exposes, or doorkeeper endpoints, or others). I'm not sure why would you want different login pages. Can you explain again in more detail the reason? Thanks!

@tute
Copy link
Contributor

tute commented May 16, 2016

@bsylvain could you move forward with this issue you were having?

@bsylvain
Copy link
Author

My question was about having two different set of views for authentication. One to allow normal devise user to login in the App, the other was for users authenticating to use a third party application. You can easily create a form for login on another view, but as soon as users mistype, they are redirected to the default login view. I had to overload the devise custom failure class to be able to have a different redirection for user login from third party app.

It works but it is a hack. I still haven't seen an app with different sets of view for authentication and oauth/doorkeeper authentication. I guess if you use doorkeeper there should be a few use cases where you want a different user experience for local login and "remote login"

@tute
Copy link
Contributor

tute commented May 18, 2016

"remote login" always ends up being a "local login", as the third party app need to know that you have a valid session in the provider as well. That said, you might still want to show different templates with different copy.

If that's the case, this is more of a devise question, à la https://stackoverflow.com/questions/27546414/devise-2-signup-flows.

You can define two different endpoints, serving two different devise forms, with a param to know were to redirect after the fact.

Will close this issue as it doesn't pertain doorkeeper, but feel free to continue asking questions and I'll help as possible.

Also, you might consider asking in https://stackoverflow.com/questions/tagged/doorkeeper, which will get attention from more people than in this issue tracker.

Thanks!

@tute tute closed this as completed May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants