Skip to content

Fix unified login snippets #997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/authentication/m2m/client-credentials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ It ensures that the validation occurs for the correct token type:
For NodeJS you can use [`jose`](https://github.com/panva/jose) to verify the token.

```tsx
import jose from "jose";
import * as jose from "jose";

const JWKS = jose.createRemoteJWKSet(new URL('^{appInfo.apiDomain}^{appInfo.apiBasePath}/jwt/jwks.json'))

Expand Down Expand Up @@ -544,7 +544,7 @@ Hence, a way to distinguish between these two and prevent errors is necessary.
import supertokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import express, { Request, Response, NextFunction } from 'express';
import jose from "jose";
import * as jose from "jose";

async function verifySession(req: Request, res: Response, next: NextFunction) {
let session = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Here is an example of how to implement this in the context of an Express API:
import supertokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import express, { Request, Response, NextFunction } from 'express';
import jose from "jose";
import * as jose from "jose";

interface RequestWithUserId extends Request {
userId?: string;
Expand Down Expand Up @@ -279,7 +279,7 @@ async function verifySession(req: RequestWithUserId, res: Response, next: NextFu
}

const JWKS = jose.createRemoteJWKSet(
new URL("^{appInfo.apiDomain}^{appInfo.apiBasePath}jwt/jwks.json"),
new URL("^{appInfo.apiDomain}^{appInfo.apiBasePath}/jwt/jwks.json"),
);

// This is a basic example on how to validate an OAuth2 Token
Expand Down Expand Up @@ -362,7 +362,7 @@ def validate_token(token: str, required_scope: str) -> bool:
api_base_path = "^{appInfo.apiBasePath}"
client_id = "<CLIENT_ID>"

jwks_url = f"{api_domain}{api_base_path}jwt/jwks.json"
jwks_url = f"{api_domain}{api_base_path}/jwt/jwks.json"
jwks_client = PyJWKClient(jwks_url)

try:
Expand Down
2 changes: 1 addition & 1 deletion docs/authentication/unified-login/verify-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ If your scenario involves a common backend with multiple frontend clients you ca
For NodeJS you can use [`jose`](https://github.com/panva/jose) to verify the token.

```tsx
import jose from "jose";
import * as jose from "jose";

const JWKS = jose.createRemoteJWKSet(new URL('^{appInfo.apiDomain}^{appInfo.apiBasePath}jwt/jwks.json'))

Expand Down