Auth0 "Authentication Error" without any helpful details
I followed the instructions for Ash Authentication Phoenix and got password auth working with some help.
Then I tried to switch to Auth0 using this quickstart: https://ash-hq.org/docs/guides/ash_authentication/latest/tutorials/auth0-quickstart
Here are the changes I ended up with https://github.com/dewetblomerus/red/pull/2/files
Now, when I click the "Sign In" button and go to
/sign-in
I see a nice "Sign in with Auth0" button.
When I click it, I go to /auth/user/auth0
which renders a blank page with the words: "Authentication Error".
Server logs:
My versions of things:
10 Replies
So the first step is to look in your auth controller and print out the reason in the failure hook
That authentication failure page is just a placeholder for what you might do on a critical failure. Typically instead of rendering the failure template you’d redirect to the sign in page with a flash message or something like that.
activity #=> {:auth0, :request}
Should I be looking at my Secrets
module that has: use AshAuthentication.Secret
?
It is using Application.fetch_env!/2
so the values definitely exist.
Or is it my User
resources that needs a secret
attribute?
I found something!
I tried this:
And saw this:
get_config(:redirect_uri) #=> :error
I typed uri
in the Secrets module and url
in my config. I'll make a suggested edit to the docs so that people will see an immediate error pointing to the problem if they do this.
It would have been nice if the Secrets module raised an error for me, letting me know that I did not supply a proper binary.Yeah, that makes sense, there should have been an explicit "internal" error raised that would tell you a secret was missing
If you get a chance, could you open an error on
ash_authentication
with that info?A github issue?
yep!
If you have time
Will do. No problem. Thanks for the help!
Today I learned to translate "This error must be happening somewhere in the framework" to "Let me see if this error is inspectable from code I wrote".
GitHub
Helpful Error from
AshAuthentication.Secret
secret_for
· Issue ...Trying to set up Auth0 using this guide I got to the login error page, but no errors were raised. Here is the reason from the AuthController: reason #=> %AshAuthentication.Errors.MissingSecret{ ...
Hey @dewet perhaps if you have a minute you could offer up your experience using auth0 here? They seem to have had some trouble during the implementation: https://elixirforum.com/t/a-toy-project-in-a-non-toy-framework-observe-my-journey-as-a-phoenix-veteran-trying-out-ash-for-the-first-time/58465/22
Elixir Programming Language Forum
A toy project in a non-toy framework. Observe my journey as a Phoen...
@olivermt really enjoying reading about your journey and thought process. Thanks very much for sharing. Please keep going!
I took a read through but I don't have anything to add. I ended up running into another error and didn't know how to debug it.
I can make a post on ElixirForum.
😦
Definitely post about it and we’ll help out