When a workflow triggered how can I make possible to use {{$nToken}} ?
(I don’t want to create API Key. It should be user token)
When a workflow triggered how can I make possible to use {{$nToken}} ?
(I don’t want to create API Key. It should be user token)
Seems an X-Y question. What scenario do you want to use {{$nToken}}
for?
I have a second docker image which get some request from nocobase and take action according to user’s demand. I have to know which user it is to insert a new record on nocobase (docker will send some information to nocobase via a creating new record)
For short answer: there is no way to use {{$nToken}}
in workflow, neither in anywhere of server side. This variable can only be used in client side.
I guess what you need is to determine which user is in the workflow context, is it?
By using different trigger type of workflows, there are different way to get user information.
createdById
/ updatedById
in trigger data of trigger variables.User acted
in trigger variables.Commonly between different NocoBase apps, the users are not same, either. Unless you did some sync on users collection.
The only way to use it may like:
API_KEY
in .env
in both apps (A and B).{{$nToken}}
in header as Authorization: Bearer <token>
.http://<B>/api/someResourceBindingWorkflow
.If I’m wrong on the scenario, please let us know more specific of yours.
Here is a scenario,
I don’t want to create and give Nocobase’s ApiKey to this docker/service.
Thank you for your interest and kindness.
Seems you want to create the JWT in server side (workflow). By now, the only way to do this is by using JavaScript node in workflow, which let you do some coding to sign a new JWT based on some user (data). Or you may need to extend a specific node type in a plugin to achieve.