My task is to create a page that has a button which says “Request Token”. This link will call an API that’s supposedly asking for username and password, and then return a token.
This API is originally not used for this case, but I wonder if there’s a way to integrate this.
Since the user has already logged in at this point, are the username and password already stored somewhere? (doubt the password is stored) Can I simply call for a token somehow? What’s a good approach about it?
Hey there @chaoism! I would love to find out more about what you are wanting to do with the “Request Token” idea. Which API by chance are you calling and what is the intended result? I want to make sure I fully understand the question so I can help you move forward. Thanks!
Hi James,
Turns out I probably don’t need this. The page where this function was supposed to reside already requires logging in, which at that point we should be able to get the token.
Though we would ideally get a token that doesn’t expire as this token should be used in a script to call our APIs… I’m still searching for the solution to that.
If it’s access token for an API you can set the token lifespan in the dashboard but there is a upper limit to the time you can set for that. There isn’t currently a way to make a never expiring token due to security precautions. We would recommend that you programmicly renew the token when it expires which this doc here can help you do that in your app. Please let me know if you have any questions!