Error using "Ruby On Rails API: Authentication"


I used the quick start “Ruby On Rails API: Authentication” successfully. Created an API and everything works just fine. Then I tried to recreate the code but including all this on an existing Rails app and got an error.

The demo (working for me before) include this call to the JWT gem:

JWT.decode(token, nil,
    true, # Verify the signature of this token
    algorithm: "RS256",
    iss: "https://" + ENV["AUTH0_DOMAIN"],
    verify_iss: true,
    aud: ENV["AUTH0_AUDIENCE"],
    verify_aud: true)

The second parameter with nil assigned, in the demo works, but in my project leads me to a JWT Error, understanding that the parameter used for public_key shouldn’t be null. But it’s null in the demo :man_shrugging: and works. I’m kind of a newbie with JWT matters.

The only difference I found between the environments of the demo and my legacy project was the Rails version, 5 in the demo, and 4.x on mine. I can’t upgrade right now, so if you think in another thing I can be doing wrong it would be helpful.

DEMO in auth0:

Hey there!

Can I ask you to raise this issue in the quickstart repo as a GitHub issue so we can work on that directly with the quickstart maintainers? Thank you!

1 Like

Thanks, here is as an issue:

1 Like

Perfect! I’ll ping repo maintainers in a few minutes!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.