Skip to content

Commit

Permalink
update alg type
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmccarter committed Nov 27, 2024
1 parent 2cc3530 commit a4eb2bd
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit a4eb2bd

Please sign in to comment.