Replies: 1 comment
-
Sorry for the late answer. I think it works now too but Its not wanted that useDirectusToken() is undefined when using static tokens. Can you create an Issue for that? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I've set a user with some view permission on certain collections. I've generated a static token in the user page and plan to use that token to access the data from my nuxt SSR web.
However, I can't make it work. The only thing I've done so far is this:
When I call
const token = useDirectusToken()
, there's no value intoken
.I have my own login system implemented. The web is a wiki/documentation password protected system, same password for everyone. When the password/JWT token of my own system is validated in the middleware, I want the web to be able to access the directus database. At logout/JWT expired, directus shouldn't be accessible.
Is there a way to make this to work? It's no clear to me what's the purpose of the static tokens if I still need to request a user/password in the frontend to access the Directus database.
Thank you!
UPDATE: For some reason, or maybe it's just a big coincidence: the user I configured for the static token at Directus didn't have any valid email. After I added a "valid" mail like [email protected] (which doesn't exist but looks like a valid one), somehow I was able to request data from the server via
useDirectusItems()
. Previously, it kept throwing "Failed to parse URL" or "401 Unauthorized" errors.useDirectusToken().value
is stillundefined
but I think that's intended. I think the problem is solved :)Beta Was this translation helpful? Give feedback.
All reactions