Skip to content

Token authentification => how to catch 401/403 errors? #9122

@alexbran8

Description

@alexbran8

Using token as auth method, how would you catch 401 or 403 errors in order to refresh the token?

This is how we use PouchDB:

       const remoteDB = (authToken: string) => {
            return new PouchDB(remoteDBURL, {
              headers: {
                Authorization: `Bearer ${authToken}`,
              }
            });
          };

config:

live: true,
retry: true,

Based on what I've tried so far, these errors are not emitted on the .onError callback.

Any help / ideas would be very appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions