X-auth-token not working

I am attempting to set up a call to get our routes from Bloomreach. I set up a token for read on the following:
Site management: Read
Content type management: Read
Content batch import: Read
Content management: Read
Projects management: Read
Folder management: Read

I have set up the end point as needed: https://{{baseEndpoint}}/cms/management/site/v1/channels/{channeId}/routes

And I am sending my created token in the headers under x-auth-token as the documentation says.

I am getting a 401 every time. Whether it’s in my application, or in Postman (I have tried manual set up, and forking the Postman item as well).

What am I missing or doing wrong?

Endpoint was off. It is now working inside my application, but I would still like to know why it does not work on Postman.

Hey Erwin,

Are you using the Postman Collection?
https://app.getpostman.com/run-collection/18378617-5dcb0302-4fce-445e-aac6-7ccc4e90018c?action=collection%2Ffork&collection-url=entityId%3D18378617-5dcb0302-4fce-445e-aac6-7ccc4e90018c%26entityType%3Dcollection%26workspaceId%3D85ed7eee-2090-41e0-8fd8-895b3e2c63d5#?env[BR%20Content%20environment%20variables]=W3sia2V5IjoiYnJ4SG9zdCIsInZhbHVlIjoiaHR0cHM6Ly9kZXZlbG9wZXJzLmJsb29tcmVhY2guaW8iLCJlbmFibGVkIjp0cnVlLCJzZXNzaW9uVmFsdWUiOiJodHRwczovL2RldmVsb3BlcnMuYmxvb21yZWFjaC5pbyIsInNlc3Npb25JbmRleCI6MH0seyJrZXkiOiJ4LWF1dGgtdG9rZW4iLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWUsInR5cGUiOiJzZWNyZXQiLCJzZXNzaW9uVmFsdWUiOiI5Njk4ZjQwMy02OGQyLTQ1NTAtODgyMi0wNTlmMjYyZDMxOGUiLCJzZXNzaW9uSW5kZXgiOjF9LHsia2V5IjoicHJvamVjdElkIiwidmFsdWUiOiIiLCJlbmFibGVkIjp0cnVlLCJzZXNzaW9uVmFsdWUiOiIiLCJzZXNzaW9uSW5kZXgiOjJ9LHsia2V5IjoiY2hhbm5lbElkIiwidmFsdWUiOiIiLCJlbmFibGVkIjp0cnVlLCJ0eXBlIjoiZGVmYXVsdCIsInNlc3Npb25WYWx1ZSI6IiIsInNlc3Npb25JbmRleCI6M30seyJrZXkiOiJjb250ZW50VHlwZU5hbWUiLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWUsInR5cGUiOiJhbnkiLCJzZXNzaW9uVmFsdWUiOiIiLCJzZXNzaW9uSW5kZXgiOjR9XQ==

Yes, and I put in my information for my project, bxrHost, and my token for the environment settings, and made sure that the environment was being used.

I also made sure, after saving, to close all my tabs so old data was not still in use.

Can you pull the CURL request that Postman is sending?
It’s the “</>” icon on the right side. Feel free to omit your “x-auth-token” value.

Helps to see how all the variables in Postman are working to get stiched into the request.

Can do! I also removed the urlEndpoint and channelId (I promise the are the values they should be)

curl --location ‘https://{urlEndpoint}/management/site/v1/channels/{channelId}/routes’ \

–header ‘Content-Type: application/json’ \

–header ‘x-auth-token: ••••••’

That looks correct. I can only give you some common mistakes I’ve made myself and seen others make.

These first 2 won’t result in a 401 if wrong, but still worth mentioning I think.

Sometimes the {urlEndpoint} Postman variable is used as {namespace}. This results in the following request being made
https://customer/management/site/v1/channels/{channelId}/routes
instead of the correct one:
https://customer.bloomreach.io/management/site/v1/channels/{channelId}/routes

Likewise, check that {channelId} is actually a valid channelId in a project with the project ID. A correct request should look like this:
https://customer.bloomreach.io/management/site/v1/channels/reference-spa-vtaYb/routes

Lastly, 401s:
There have been some issues where tokens have been revoked. We seem to have resolved this issue, but it’s possible you may be experiencing another version of the issue. Just check that your API token still exists in the CMS UI under “brXM API token management”

The only other thing I can think of is that when selecting the permission check boxes, you may have missed the site management box.

Thank you for your help Nicholas. I came back the next day, retried the token creation a couple of times, and it finally started working after creating a 3rd token (same settings as mentioned before). Very strange, but it is at least working now.

Happy to hear, Erwin. Thanks for the update.