Back

If it possible to intercept request & response?

  • 0
  • Tools
  • Accounts
Vedsaga
16 Mar, 2023, 10:51

As, some asked this question, How do I generate the token incase 15 minutes elapse or will have to generate a new one? And Steven answer have to generate new one. So in that case, it's possible if we can have a interceptor at top level and when Appwrite exception occurs that get trigger and and generate new token and then save the local storage and then recall the failed request.

cc @Steven

TL;DR
The user is asking if it is possible to intercept requests and responses. They want to intercept the response and update the local storage if there is an error due to an expired token. They do not want to increase the time limit for the token. They provided a link to a previous conversation about generating a new token if 15 minutes elapse. They are looking for an architecture to handle this scenario. The response suggests providing more context or backlinking previous messages for a better understanding. No solution is provided.
joeyouss
16 Mar, 2023, 11:36

Hi, since this seems like a continuation of a past conversation, can you probably back link the messages so I understand more about this and/or you can give me more context?

Vedsaga
16 Mar, 2023, 11:49

hi, sure this is what I found when last time some asked related to this around 02/08/2022.... https://discord.com/channels/564160730845151244/564161903685795841/1003982972409622599

Vedsaga
16 Mar, 2023, 11:56

@joeyouss so right now, config the project architecture so that once I start working on feature logic I don't have to keep changing the architecture. So it would kind of you if you could help answer this one. Thank you πŸ™

joeyouss
16 Mar, 2023, 12:43

Thank you for sharing @Vedsaga let me take a look

joeyouss
16 Mar, 2023, 12:46

If this is regarding the JWT token, why do you want to increase the limit from 15 minutes? πŸ€”

joeyouss
16 Mar, 2023, 12:47

Is there a possibility you can share more about the use case so maybe we could either help you fix this or come up with a workaround as you suggested

Vedsaga
16 Mar, 2023, 12:53

something like this interceptor works in http, (just rough diagram of interceptor-architecture)

Vedsaga
16 Mar, 2023, 12:54

ah, no no I don't want to increase the time at all.

Vedsaga
16 Mar, 2023, 12:55

just that, I want app write response to be intercepted if response have error due to expire-token so that I can recall the create-token and then update the local storage and then again recall the failed request again...

Vedsaga
16 Mar, 2023, 12:56

I hope I am making sense here

joeyouss
16 Mar, 2023, 13:53

Yes you are making sense, I understand what you are trying to implement

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more