Recent

Author Topic: http interceptor  (Read 534 times)

Packs

  • Sr. Member
  • ****
  • Posts: 492
http interceptor
« on: February 20, 2025, 04:39:50 am »
I am using http client to connect third party api.

They provide 2 token . one for login and another for other api calls

how to use http interceptor in lazarus .

once my login token expired . I have use refresh token.

how to implement this.

xint

  • New Member
  • *
  • Posts: 33
Re: http interceptor
« Reply #1 on: February 20, 2025, 06:20:05 pm »
Usually there is one API entry point where you authenticate with your secret and another one that you use to query after authentication.

There are more then just one way to authenticate. When you say, that you have two tokens, I would assume that 'authentication: bearer' is the way to go ...
Once we know which API, better what kind of authentication is required, we can guide you into the right direction (-;

Packs

  • Sr. Member
  • ****
  • Posts: 492
Re: http interceptor
« Reply #2 on: February 20, 2025, 07:52:41 pm »
Login token is for 10 seconds..
Api token or refresh token for 5 hours.

This we achieve in angular by using http interceptor.

Whenever any call you make api . Http interceptor get call
And we validate ang use refresh token

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: http interceptor
« Reply #3 on: February 21, 2025, 04:45:36 pm »
There should no need for any interceptor. An authentication/authorization flow that provides both access and refresh token such as OAuth typically tells you when the access token is expired and needs to be refreshed by calling another endpoint supplying refresh token, which will respond with the new access token as well as new refresh token for subsequent refreshes. However, without knowing any details, we can only guess. There are multiple authentication/authorization flows available, no idea which your third party API uses.

 

TinyPortal © 2005-2018