Ruby auth0 gem - how to configure with Client Key? I keep getting "unauthorized" / "invalid token"

Using Ruby auth0 gem 5.8.0

I’ve written an auth0_client function based on the one in the auth0 gem’s homepage and plugged in my app’s credentials, but I keep getting:

{"statusCode":401,"error":"Unauthorized","message":"Invalid token","attributes":{"error":"Invalid token"}}

This is my function:

  def auth0_client
    @auth0_client ||= Auth0Client.new(
      client_id: xxx, # value from my app's "Basic Information" page
      client_secret: xxx, # value from my app's "Basic Information" page
      domain: xxx # value from my app's "Basic Information" page
      api_version: 2,
      timeout: 15

      # I don't need this, do I?
      #token: ENV['AUTH0_RUBY_API_TOKEN'],
    )
  end

What can possibly be wrong with the credentials that I passed in? Am I missing something? What token is invalid?

We figured out that we missed: we didn’t have permissions set for the Management API.

The interface is kind of easy to miss. On the application’s API tab, you need to click the little drop-down arrow on the right to open up the permissions pane:

1 Like

Glad to know you have found the solution! Thank you for sharing it with our community! :clap: :+1: