How to hold temporary data between API calls/endpoints?
Options
![Jay](https://us.v-cdn.net/6037124/user_avatars/2364889.jpg)
Jay
Member ✭
There is an API which for its authentication to get an auth token requires creating a unique random and temporary id which you add to the first request.
It then redirects to the redirect_uri you predefined with 2 query parameters, one of which is the id provided before, and that call needs to verify that it is the same id.
So i created one call that sets everything up and uses a uuid to create the verification code, then created another endpoint which is the redirect uri where i want to verify that it is the same code i created in the last call being passed back.
So i need to pass the uuid i made to this call which means saving it somewhere. Is there a best practice for saving or passing temporary data?
I thought to save it to a user table but i won't know the user id until the end of the second call. Should I create a temporary id, or use the uuid as the user id, and at the end change it to the actual username? How would I even pull up the correct user record on the second call?
It then redirects to the redirect_uri you predefined with 2 query parameters, one of which is the id provided before, and that call needs to verify that it is the same id.
So i created one call that sets everything up and uses a uuid to create the verification code, then created another endpoint which is the redirect uri where i want to verify that it is the same code i created in the last call being passed back.
So i need to pass the uuid i made to this call which means saving it somewhere. Is there a best practice for saving or passing temporary data?
I thought to save it to a user table but i won't know the user id until the end of the second call. Should I create a temporary id, or use the uuid as the user id, and at the end change it to the actual username? How would I even pull up the correct user record on the second call?
Comments
-
Hey ,
You can follow how this was done for Twitter OAuth. They require a separate table to keep track of a secret between api calls.
If you want something more temporarily, you could use Data Caching via redis. That lets you store key/value pairs in temporary storage. If the TTL between calls isn't long, then this could be an easy win. -
Looks like data caching is on the $200/m plan?
-
Ok i see how it was done in twitter auth, i can work with that
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback