Skip to content

Implement JWT refresh endpoint #784

@truedat101

Description

@truedat101

In our use of 6.14.1 arangojs, we have something like this snippet below. We notice that over time, eventually our connection starts getting 401 auth errors on all requests, embedded in some nestjs nasty error dump: not authorized to execute this request {"code":401,"errorNum":11,"isArangoError":true ......

This happens at exactly 30 days from the last server reboot. The problem appears to be that the session JWT token expires as it relates to the DB auth. While that is not a lost cause, it is clearly a problem in the app hanging on to the connect and not closing them as they are finished, or not having a way to refresh the token on a sane interval (my preferred approach), or having some fall back logic to restore a connection. I'll go about figuring out the third option. That said, what is the recommended practice with this driver? I am using NestJS and there really aren't any active / strong database provider integrations unfortunately that are active and our own is a variant of a version from some years ago. Is there any possibility that a new driver version handles this behavior differently?

Any advice will help.

const config = {
      url: env.dbUrl,
      maxRetries: 25,
      precaptureStackTraces: true
    };
    const db = new Database(config);
    db.login(env.dbUser, env.dbPass);
    db.useDatabase(env.dbName);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestRequest for new functionality to be added to the driver.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions