3

I am trying to get directus user token. For this purpose I am using Postman. But when I send a POST request to the api with user login credentials. I get this error:

We're sorry but Directus doesn't work without JavaScript enabled. Please enable it to continue.

I want to access the (user token). Is there any alternative way to get user token in Directus CMS. Any help will be appreciated.

Thank you.

Awais Khalid
  • 86
  • 1
  • 8

2 Answers2

1

We're sorry but Directus doesn't work without JavaScript enabled. Please enable it to continue.

If you're seeing the above error, I would imagine you're sending a post request to the Javascript frontend and not the API.

I would expect you to send a request to something like: https://demo-api.directus.app/_/auth/authenticate

With post JSON body like: { "email" : "admin@example.com", "password" : "password" }

Docs: https://docs.directus.io/api/reference.html#get-auth-token

Shea Lavington
  • 436
  • 2
  • 7
0

You could try the static token. It is generated for each user on directus_users.token. It's a little less-secure (depending on how you're using it) since it doesn't change, but should be much easier:

https://docs.directus.io/api/reference.html#static-tokens

RANGER
  • 1,643
  • 2
  • 17
  • 31