victorbjorklund
How to to control which users can use which login methods in Ash authentication
So the use case is that I’m using Ash authentication and for 95% of users they will have to log in with my custom strategy that we built that is hooking up Swedish Bank ID. But we know that there could be a few users that do not have such a Swedish bank ID, and we need to be able to provide them with an alternative way to log in and we’re gonna use password.
But we would like to have some way of preventing users who have a bank ID to login with the password (Yes, you could argue that it’s stupid to prevent users from using multiple different authentication methods, but that is the requirement).
Is there some way to enforce this behavior to have it stored in the user table or somewhere like that, which users are allowed to use which login methods?
Most Liked
zachdaniel
You can put some logic in the action that signs them in and add or return an error in an after_action hook
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









