API Error: No authorization token was found

SDK: express-jwt & jwks-rsa
Version: 4.17.3 & 2.0.5
Platform: Node.js 6.14.15 & express 4.17.3

I am following the sdk sample provided in the getting started for node.js but I am getting an 401error that states that no authorization token can be found. I think it is related to this step:

  1. Choose a JWT library

As your API will be parsing JWT formatted access tokens, you will need to setup these capabilities on your API.

You can navigate to jwt.io and choose from there. Remember to pick a library that support your selected signing algorithm.

I have no idea what this step is asking me to do. Please can you help elaborate?

I tried copying one of the example sdks auth0 provides and just filling in the necessary information and I am still getting the same error.

1 Like

Hi @abroadhurst!

Do you mind sharing the specific sample(s) you’ve been working with?

It sounds like there is no Authorization header being included in the request and thus no authorization token - Basically, the middleware is checking to see if there is a valid Access Token included in the Authorization header, and in this case the header might be missing altogether.

For example, you can see this in action in our React sample:

    try {
      const token = await getAccessTokenSilently();

      const response = await fetch(`${apiOrigin}/api/external`, {
        headers: {
          Authorization: `Bearer ${token}`,
        },
      }); 

This code + sample app can be found here.

Hope this helps!

3 Likes

Yess thanks for sharing it that worked for me!

1 Like

Awesome! Good to know - Thanks for confirming :smile:

1 Like

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