How to disable OAuth account creation for certain routes #22
-
Basically, there's a common pattern with OAuth where if you're on a "Login" page and you hit "Login via GitHub" , but you haven't previously created an account via GitHub , it will automatically create the account for you. I don't want that behavior. I want the user to have to explicitly go to is there a good way to get this behavior? I feel like I'm missing something obvious. basically, when on "/login", don't create accounts, only check for existing. is there an easy way to do this? I'm using Rodauth-Rails as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I just pushed a new button_to "Login via GitHub", rodauth.omniauth_request_path(:github, action: "login"),
method: :post, data: { turbo: false } Then control automatic account creation based on that query parameter: omniauth_create_account? { omniauth_params["action"] != "login" } I will make a new release with this feature, just want to properly document it first, possibly with a similar example. |
Beta Was this translation helpful? Give feedback.
I just pushed a new
omniauth_create_account?
configuration option that controls whether the account will be auto-created if missing. When generating the OmniAuth login link, you can pass a query parameter that will identify the action, for example:Then control automatic account creation based on that query parameter:
I will make a new release with this feature, just want to properly document it first, possibly with a similar example.