Easy, Store the expired time in the token, and hash them. When the expired time almost reach, use the old token to get a new token.
> On Mar 12, 2020, at 09:25, Renato Marcandier <renato.marcand...@gmail.com> > wrote: > > Hello guys, > do you have any HelloWorld project in GO using RESTful to issue HTTP requests > from within a Golang application to remote RESTful/API with web token that > expires every 60 minutes and then consume any data that is returned? > I am trying to get a simple HelloWorld. First, I need to do a POST to grab > the new token and after using this token to do a GET and see the response > with "Hello World!" using the following parameters: > ------------------------------------------------------------- > POST: > > Using: > grant_type: password > client_id: xxxxx > client_secret: xxxxx > username: xxxxx > password: xxxxx > > URL: > https://cloudsso.cisco.com/as/token.oauth2?grant_type=password&client_id=xxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxx&username=xxxxxxx&password=xxxxxx > > <https://cloudsso.cisco.com/as/token.oauth2?grant_type=password&client_id=xxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxx&username=xxxxxxx&password=xxxxxx> > > Response: > { > "access_token": "tMqvXkR4wTvFwKUNUvMrNUXdzkjD", > } > > ------------------------------------------------------------- > GET: > > Using: Bearer Token > URL: https://api.cisco.com/hello <https://api.cisco.com/hello> > > Response: > {"helloResponse":{"response":"Hello World!"}} > > > Regards > RG > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com > <mailto:golang-nuts+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAGbJOOiT8fm7z6t5pNiFSmkXZy2KXs8Xdw-Cq0BkUD1CbUNExA%40mail.gmail.com > > <https://groups.google.com/d/msgid/golang-nuts/CAGbJOOiT8fm7z6t5pNiFSmkXZy2KXs8Xdw-Cq0BkUD1CbUNExA%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4C76B950-358E-4E9D-ADE8-B681B7F2EC44%40icloud.com.