Skip to content

How to disable OAuth account creation for certain routes #22

Answered by janko
KonnorRogers asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@KonnorRogers
Comment options

@janko
Comment options

@KonnorRogers
Comment options

@janko
Comment options

Answer selected by KonnorRogers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants