App: Pulls minimum and maximum estimated delivery dates for eBay items
Background: I am planning on introducing APIs to my grade 4-8 students. I already have a part of the tutorial working that fetches data from a weather station and I am trying to tie that with an API from eBay.
Issue: Authorization token has a very short expiration and therefore the app needs a solution which involves the refresh token to generate a new authorization token and then integrates the new auth token in the API request.
I apologize if this seems trivial or there is a solution already out that I have missed. I am new to APIs and after being pleased with myself in creating an app to do what I wanted, was humbled very quickly the next morning when I learnt about the short expiration of authorization tokens.
The app works whilst the authorization token is valid, however it would need to manually updated very regularly. The issue is I am new to APIs and not familiar with the terminology and therefore struggling to find the answer. I think I have seen that I should use some kind of service that deals with the API request server-side, but I’m not entirely sure if makes sense as a sentence, as I’m getting to grasps with the concepts. I know I need to transition to using a refresh token but cannot work out the next steps.
I would love either a pointer to a useful resource, previous solution or explanation.
I have chosen the eBay API as I have not seen any age limitation in their terms of agreement, which is important as I’m hoping to pass on the knowledge to my students once I have figured it out and they can follow along themselves with a tutorial. It is also free.
Here is the current working code for the eBay part (when the token is valid)
Thanks,
Jason.