Describe the problem/error/question
What is the error message (if any)? Not an error. This is a “how do I” question.
I know I’m doing this insecurely. This question is trying to rectify that. I have this workflow to generate a bearer token if the expiration time has lapsed. I want to use stored username/password, and if possible, store the bearer token until it needs to be replaced.
The workflow gets the username and password, along with the current bearer token, it’s expiration from a local store.
If the bearer token is expired, it uses an http node to call the server to have it generate a new token.
Finally, it returns the valid token to the calling workflow. I use this for multiple clients, so I would like to be able to specify which credentials it will be using when I call this workflow.
The purpose of this post is to secure the credentials. Since I use this for many clients, any solution should be able to call the appropriate credentials.
Please share your workflow
Share the output returned by the last node
This is the bearer token (expired!) returned by the API server.
[
{
"mosyle":
{
"AuthToken": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3Nzg3ODMxMDEsImV4cCI6MTc3ODg2OTUwMSwiaXNzIjoiTW9zeWxlIiwiZGF0YSI6eyJWWE5sY2tsRSI6Ik5qVTNOak15TWc9PSIsIlpXMWhhV3c9IjoiYmpodVFHcDFjM1JwWTJWaGJtUnFiM2x1WVhSc0xtOXladz09IiwiWVdOalpYTnpWRzlyWlc0PSI6Ik5USXlOV0V6TnpZeVlUWmhNamRqTldabFpEVmhOVEl6TjJRek4yTTNOemMzTjJZM04yUXpNMlExWmpRM05UUTFZVGMyWldVMFpqVmpOemMxTW1FM013PT0ifX0.WtiAgibdCQ2pp03Za-FJ2BlGRYy0wxd3vhxIiY-6mDE"
}
}
]
Information on your n8n setup
- n8n version: 2.20.6
- Database (default: SQLite): PostgresQL 15
- n8n EXECUTIONS_PROCESS setting (default: own, main): Own
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker on Digital Ocean.
- Operating system: Ubuntu 24.04
