Auth0 confusion

Hello, I'm trying to setup ash auth with Auth0 I followed the tutorial but I don't understand how the "/auth" routes are created or how should I create them
9 Replies
dmitriid
dmitriid•2y ago
In router.ex: - Add use AshAuthentication.Phoenix.Router to the module - In whichever scope you use for auth, add the folliwing, e.g.
scope "/", YourAppWeb do
pipe_through :browser

#... whichever other routes you have ...

# Ash auth
sign_in_route()
sign_out_route AuthController
auth_routes_for YourApp.Module.Implementing.The.Auth, to: AuthController
reset_route []
# End Ash auth
end
scope "/", YourAppWeb do
pipe_through :browser

#... whichever other routes you have ...

# Ash auth
sign_in_route()
sign_out_route AuthController
auth_routes_for YourApp.Module.Implementing.The.Auth, to: AuthController
reset_route []
# End Ash auth
end
(it took me a while to wrap my head around, too šŸ™‚ )
samoorai
samooraiOP•2y ago
Does this work for Auth0 though? Beacuse as far as I understand there should be a "/authorize" and a "/userinfo" as the documentation says https://ash-hq.org/docs/module/ash_authentication/3.10.6/ashauthentication-strategy-auth0 Am I missing something?
Ash HQ
Module: AshAuthentication.Strategy.Auth0
View the documentation for AshAuthentication.Strategy.Auth0 on Ash HQ.
dmitriid
dmitriid•2y ago
This is the full setup I have: https://gist.github.com/dmitriid/2ae3ae7737c640e9a5de42e79bef1bfb For
{:ash_authentication, "~> 3.11.1"},
{:ash_authentication_phoenix, "~> 1.7.2"},
{:ash_authentication, "~> 3.11.1"},
{:ash_authentication_phoenix, "~> 1.7.2"},
I hope this helps.
Gist
Ash Auth0
Ash Auth0. GitHub Gist: instantly share code, notes, and snippets.
samoorai
samooraiOP•2y ago
thanks man after a little digging I found out that the strategy auth0 create some "magic" routes by itself without needing to specify them in the router so that was the poblem
dmitriid
dmitriid•2y ago
No worries šŸ™‚ It took me a while to understand how it's wired. I think that's all the modules you need
samoorai
samooraiOP•2y ago
the documentation is not very clear about that
dmitriid
dmitriid•2y ago
Yup, there's magic šŸ™‚ If I ever come around this, I should definitely do a PR against the docs
samoorai
samooraiOP•2y ago
Yes I think a will make one in the future just to be more clear thank you @dmitriid I think I'm gonna "steal" some of your code ahahaha šŸ™‚
dmitriid
dmitriid•2y ago
Of course šŸ™‚

Did you find this page helpful?