Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions advanced/user-auth/jwt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you don’t have a dashboard, or if you want to keep your dashboard and docs
Create a login flow that does the following:
- Authenticate the user
- Create a JWT containing the authenticated user's info in the [UserInfo](./sending-data) format
- Sign the JWT with the secret, using the ES256 algorithm
- Sign the JWT with the secret, using the EdDSA algorithm
- Create a redirect URL back to your docs, including the JWT as the hash
</Step>
<Step title="Configure your User Auth settings">
Expand Down Expand Up @@ -46,7 +46,7 @@ import { Request, Response } from 'express';

const TWO_WEEKS_IN_MS = 1000 * 60 * 60 * 24 * 7 * 2;

const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'ES256');
const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'EdDSA');

export async function handleRequest(req: Request, res: Response) {
const userInfo = {
Expand All @@ -59,7 +59,7 @@ export async function handleRequest(req: Request, res: Response) {
};

const jwt = await new jose.SignJWT(userInfo)
.setProtectedHeader({ alg: 'ES256' })
.setProtectedHeader({ alg: 'EdDSA' })
.setExpirationTime('10 s')
.sign(signingKey);

Expand Down