Authentication token and refraining from using Cron

This week, i spent a few days figuring out what I can do to refresh our authentication token from the Petfinder API. I had been looking through various scripts and one that caught my was Cron. A CRON script is a list of one or more commands to a computer operating system or application server that are to be executed at a specified time. As mentioned in an earlier blog post, i referred to this link react-js-cron - npm (npmjs.com) and read more about cron script for React JS. As i started to implement some of the steps, I found myself dealing with errors concerning deprecated scripts and possibly needing to download more software from the host repository. The terminal command for npm install -n led me down researching errors on updating our libraries but these updates didn't seem like the right way to handle the solution to the authentication token problem.  I didn't want to add more memory usage to the overall files.

I decided to search the internet for a solution that did involve adding any extra libraries to Pethub. I stumbled upon this article React Token Auth | Codementor. They first talk about using nom install which was already done within our app but, i updated with it anyhow. There are many ways to set up an automatic renewal of an authorization token but, i went ahead and made it pretty closely to what they have as an example in the article. UseEffect allows you to use a "hook" and perform certain function within a component. The useEffect is used to help code interact with the "outside world". Fetching data from an API pr setting up event listeners. I needed to figure out if our Auth key was expired, if so, then use the command and provide a new then update the function that needs this token with the new token.
The article goes on to talk about how to get a new token if the previous one is expired. At this point, I have not had to update my authorization key manually from this point on. I am going to move on to the next step and update my blog on another day soon.

This past Thursday was our Weekly meeting. We talked about some of the problems we had during our current month. I notice that the team is starting to wrap up the finishing touches with our features. I have been trying to get the description to become readable in its entirety. As of now, when we retrieve the .json data, the description is truncated. I brought the issue to our instructor; we have some solutions that involve transferring data around and then making everything available that way and then making a copy of that information and paste it in the description. He also introduced the idea of extracting a URL from the API and redirecting the user to another page with the information accessible with a read more link. But we would need to to practice an error proofing approach to everything like this. This reminds me of something called poka - yoke. Poka-yoke - Wikipedia. Making things fool proof for a user is very interesting and makes the user experience something of a safe nature.

Comments

Popular posts from this blog

Long week of Detailing