REST API Bearer Token

Hi

I have created a Python script that uses the Rest API to pull data from a selection of BAQs.

All works fine on the day it is created but the next day it stops as the Bearer token has changed. Do I need to get a new Bearer token each day?

See if this link helps:
https://www.epiusers.help/t/function-library-working-with-sharepoint/114327/16

1 Like

I don’t think that link will help but I think @josecgomez has some code on here somewhere for the epicor token stuff.

(if needed)

As for the bearer tokens, yes they expire, I don’t know the details.

Now that I think about it, the link to my thread may help at least in concept, for storing a bearer token, and just refresh it as needed.

I dunno.

Ya that was the part I remembered from yours. I thought @josecgomez had a post about requesting one through REST, but I couldn’t find it :frowning:

1 Like

This was the closest I could find

1 Like

Bearer tokens expire usually with a couple of hours if you want to see what the expiration time is paste it into

jwt.io and it will tell you

This is normal security and you must provide a renewal mechanism. If your app is not going to be constantly up and active you’ll have to either schedule the renewal or simply get a new one right before you make the call if the last one expired.

4 Likes

Thanks everyone. I found the Ice.LIB.TokenServiceSvc which lets me check and request a new token.

3 Likes