Auth Token not working

Similar to [How do I get an auth token](

In my ruby app, I have:

url = URI(''\

    http =, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE

    request =

this returns a 302 response, where the body is simply:

Found. Redirecting to /u/login?state=hKFo2SBEMU5CY... (etc)

According to the documentation, I should instead be getting:

HTTP/1.1 302 Found
Location: http://localhost:3002/auth/auth0/callback?code=AUTHORIZATION_CODE&state=xyzABC123

Now when I instead enter the URI above into the browser, it does correctly respond with http://localhost:3002/auth/auth0/callback?code=CORRECT_CODE&state=STATE, although it raises a CSRF response.

How can I get this to work from inside the server instead of via the browser?

Hello @wrftaylor. response_type=code implies you are using the authorization code flow, which means you are logging in as a user. If you want to do this without user interaction you need to use the client credentials flow instead which allows for machine-to-machine communications without user interaction.

1 Like

Thanks markd! Ok, that’s clarifying.

Teamwork makes the dreamwork!