How to implement API auth? #169
Unanswered
frederikheld
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
Hey @frederikheld. Not sure how your use case is, but maybe you can add to the job itself a step to get a new access token on every retry? |
Beta Was this translation helpful? Give feedback.
4 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.
-
Hey,
I have a question about how my Jobs get authorized to access my protected REST API.
My first approach was IP whitelisting that allows certain IP's to bypass auth. This turned out to be brittle: a wrong configuration can either block all access or allow the whole world to access it. It might also become difficult to handle if I start to scale runners and each has their own IP.
So now I'm going with service tokens. When a Job is enqueued by my backend, the backend mints a token that gets passed as parameter into the Job. The job can use this token to exchange it for a auth token. This allows me to treat the whole API as public and use the same auth-mechanism for services as I use for human users. The caveat is that - for security reasons - a service token can be exchanged into a access token exactly once.
This creates the issue that I can't re-run jobs from the Sidequest admin dashboard. The job itself is idempotent, but the auth mechanism is not.
It's not really a problem as I'm planning to implement a mechanism to re-run jobs in my Admin app.
But I'm still thinking if there's a better way to do this that is secure and convenient at the same time.
So how are you guys doing this?
Beta Was this translation helpful? Give feedback.
All reactions