On Aug 27, 2024, at 6:58 AM, Sergio Charrua via
sr-users <sr-users(a)lists.kamailio.org> wrote:
Hi all!
I need to integrate a REST Service with Kamailio. Integration is easy, not a problem, but
my concern is that the REST Services has a JWT token authentication required for each
request, common to many (it not all) REST Services.
So, it is required to POST for authentication (username and password) and once I get
authentication done, and receive a JWT token, I will need to use this token in all other
requests to the REST Service. The token is valid for 24h.
My question is:
- how to save the token for use during 24h, on all calls/sessions, without the need to
authenticate on every call?
- how to detect the token has expired and re-authenticate?
I looked for some modules, but could not find any that suited me.
I am thinking of executing a Python script for this, but concerned about latency and
PDD....
Any thoughts? Any suggestions? Any known best-practice?
Atenciosamente / Kind Regards / Cordialement / Un saludo,
Sérgio Charrua
Have you considered an inbetween service (such as a go/python/node api listener) to handle
the authentication / token issuance part?
In theory I assume you could use the JWT and other modules to help do what you are looking
for, but you’re really hacking kamailio to be an http api server at that point and
although it may be able to do it quite well, it’s really not the first candidate I’d
choose for the job.
Regards,
Fred Posner
https://fredoso.com