I'm using an alternative table/collection of users, independent of Directus users. The frontend interacts with these users data via custom extensions.
Currently all functions are authenticated via a bearer token that's sent to the custom extensions via:
` const bearer_token = 'tokenstring';
const options = {
method: 'POST',
cache: 'no-cache',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json',
'Authorization': Bearer ${bearer_token}
},
body: JSON.stringify(postdata)
}
let url = "https://serveraddress/customextension/:request
fetch(url, options) ...`
bearer_token is generated from a Directus user and so, the custom extensions are acting as that Directus user.
The problem
The bearer_token being used is available to inspect in the front end source code.
My question
Can I declare the token in the custom extension?
I can only find the js standard of using it in Authorization, but if I can use it in my custom extension code, I can keep it discreet.