The problem is, every time the token expires, I have to come back and use the Swagger UI to authenticate, and copy the Bearer token to my app.
I would like to know, how Swagger is creating it? And how could I implement it on my machine so that everytime it expires, my app creates it itself instead of getting an error and changing it? I tried many ways, but I couldn't get the Bearer token the way Swagger gets it. It only works when Swagger creates it.
Thank you for your information. But when I decrypt the Token generated by Swagger, there are extra un-encryptable parts (I mean some parts remain hashed). What you provided is good but I'm looking for actual code here. A way to generate the Bearer token just like Swagger. Any other way I try it, the API doesn't accept it. But when Swagger generates it, it is all heaven! When you have a good experience in your field and can't fix such simple issue, it really drives you banana!