#401 Unauthorized error in Inbox component in v3.11.0 self-hosted

1 messages · Page 1 of 1 (latest)

brisk ruin
#

Hi,

We are using v3.11.0. We have everything working as far as Chat providers go (Slack, MSTeams work great), but we are having trouble integrating the Inbox component.

We use the novu/[email protected] component and we've integrated the React component into our application:

  • We get the token from the session
  • The first time we refresh the page with the component - we DO get test notifications that have triggered manually.
  • However, every subsequent API call fails with a 401 (Unauthorized) and we can't understand why this happens.

Any help would be greatly appreciated.

fading wigeon
#

Are you encrypting the subscriber id with novu secret key?

Something like this:

  // --> Generate HMAC for in-app notifications
  let novuSubscriberHash = null;
  if (process.env.NOVU_SECRET_KEY && novuSubscriberId) {
    novuSubscriberHash = createHmac('sha256', process.env.NOVU_SECRET_KEY)
    .update(novuSubscriberId)
    .digest('hex');
  }
  // <-- end of HMAC generation

This is how the current user can "authenticate" with novu so they can get their notifications, change their settings, etc. If you're not doing it you might need to before using in prod.

Once you have the novuSubscriberHash, you use it to instantiate novu instance.

brisk ruin
#

We are not using the encryption. This is a local set-up, do I still need to do it?

brisk ruin
#

Attaching logs of a requested which succeeds and then one that fails immediately after