Toto
Toto

Reputation: 19

Devise with only Omniauth: how only to use login page of the provider

My application is implemented with Devise and local database authentication. I am replacing it by omniauth provider. By keeping devise (to limit too many changes).

So, in the app/views/devise/sessions/new.html.erb, a link button 'Login with provider' added on the login page, as following:

<%= button_to user_keycloakopenid_omniauth_authorize_path, method: :post , data: {turbo: false} do %> <span> Login with Keycloak </span> <% end %>

When clicking on this link button, the user is redirected to the provider login page. Then after a successul login, the user is redirected to my app.

All is working.

As you can see, the user should first opens the new.html.rb then click on this link buton to sign in. So I want now to remove completely the new.html.erb file, ie: When an user tries to access to the application, the user will be redirected to the login provider page (if new session) as what is done by the link button.

I have seen this note text, "Using OmniAuth without other authentications", but the new.html.erb is still used.

Overriding the Devise::SessionController:new method, to do this POST action (so not to render new.html.erbanymore), is it the solution ? Or any idea please ?

Upvotes: 1

Views: 79

Answers (0)

Related Questions