[#336] How to handle expiration

Migrated from Redmine #336 | Author: Tavan Eftekhar
Status: New | Priority: High, I’m very impatient | Created: 2019-02-09


I’ve heard that access to the API expires, but I’m not sure which part of the login process expires and needs to be redone.

Here is my login process resulting in a client:

@let loginClient = new JSONRpcClient({
‘url’: ‘https://user-api.simplybook.me’ + ‘/login’,
‘onerror’: function (error) {},
});

        const token = loginClient.getToken(sbmUser, sbmKey);


        this.client = new JSONRpcClient({
            'url': 'https://user-api.simplybook.me',
            'headers': {
                'X-Company-Login': sbmUser,
                'X-Token': token
            },
            'onerror': function (error) {}
        });@

So assuming someone is using this app for a few hours, at some point it will stop working and I need to reconnect, but do I need to redo all steps?

Thanks for any help

Redmine Admin wrote:

Hi,

You need to handle expiration exception and regenerate token when got it. So, simple answer is yes. You will need to redo auth steps (not sure which steps you mentioned above) to get new token.