Skip to content

NextJS API Auth. #21

@arunreddy

Description

@arunreddy

Hello,

I was following the documentation at https://docs.propelauth.com/reference/backend-apis/nextjs. Using the manual token is failing with the following error with Next JS 13.5.2.

import { initBaseAuth } from "@propelauth/node";

const propelauth = initBaseAuth({
  // You can find these fields under the Backend Integration section for your project in PropelAuth.
  authUrl: "YOUR_AUTH_URL",
  apiKey: "YOUR_API_KEY",
  manualTokenVerificationMetadata: {
    verifierKey: `YOUR
        MULTILINE
        KEY`,
    issuer: "YOUR_ISSUER_URL",
  },
});

Error:

UnauthorizedException [Error]: secretOrPublicKey must be an asymmetric key when using RS256
    at verifyToken (webpack-internal:///(rsc)/./node_modules/.pnpm/@propelauth+node@2.1.4/node_modules/@propelauth/node/dist/index.js:20354:19)
    at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@propelauth+node@2.1.4/node_modules/@propelauth/node/dist/index.js:20329:16)
    at Generator.next (<anonymous>)
    at fulfilled (webpack-internal:///(rsc)/./node_modules/.pnpm/@propelauth+node@2.1.4/node_modules/@propelauth/node/dist/index.js:42:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 401
}

When manualTokenVerificationMetadata is removed, it works. Manual token verification is not used for https://docs.propelauth.com/reference/backend-apis/node.

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