{"error":"Unauthorized","status":401,"message":"Invalid OAuth token"}

Getting status 401 sometimes then i need to wait 10-15 minutes and it works again sometimes, then i get this error again.

Looks like token expires whole time,

api.js looks like;

export const getAccessToken = async (req, res) => {
    const Cookies = await require("cookies");
    const cookies = Cookies(req, res);
    let token = cookies.get("token");
    if (!token) {
        const moment = await require("moment");
        const data = await getToken();
        cookies.set("token", data.access_token, {
            httpOnly: false,
            expires: moment().add(data.expires_in, "milliseconds").toDate(),


**In ignonito mode chrome and other webbrowser it works all time, Never problem..** 

*Also, I moved from vercel to digital ocean droplet yesterday, website worked perfect on vercel.*

What calls are you actually doing.

Your code doesn’t make any sense.
Not sure why references to cookies are in here.

can i upload the file here? I call alot. :slight_smile:

If you get a 401 means the token has expired or is not valid

If the token is expired or not valid then you need to get a new token from the user

The authentication documentation is here:

but why it expired in 15-20 minutes?

I see that you have write before on this forums that is expired in 60 days.

Implict auth tokens are good for 60 days (generally)
App Access is 60 days (generally)
And regular tokens 4 hours

I don’t understand your problem, if the token is dead, reauthenticate the user

maybe im wrong, Did you talk about new client_id and auth_token for my app? Sorry if it dumb questions :smiley:

Your question doesn’t make sense

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.