Replies: 2 comments
-
|
we haven't tested yet. you can try it and let us know if anything is not working. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Logto works well with Cloudflare in a few different deployment patterns: 1. Logto behind Cloudflare proxy (most common): Key considerations:
2. Cloudflare Pages + Logto Cloud: # If using Logto Cloud, just configure CORS in Logto Console
# Add your Cloudflare Pages domain as an allowed origin3. Workers AI integration (for serverless + auth): // Cloudflare Worker with Logto JWT verification
import { createRemoteJWKSet, jwtVerify } from 'jose';
const JWKS = createRemoteJWKSet(
new URL('https://your-logto-endpoint.com/oidc/jwks')
);
export default {
async fetch(request: Request): Promise<Response> {
const token = request.headers.get('Authorization')?.replace('Bearer ', '');
if (!token) return new Response('Unauthorized', { status: 401 });
const { payload } = await jwtVerify(token, JWKS, {
issuer: 'https://your-logto-endpoint.com/oidc',
audience: 'your-api-resource',
});
// payload.sub = user ID, proceed with request
return handleRequest(request, payload);
}
};Common Cloudflare + Logto gotcha: Cloudflare's Rocket Loader can interfere with Logto's SDK initialization. Disable it for pages with Logto sign-in: <script data-cfasync="false" src="logto-sdk.js"></script>What's your specific setup — self-hosted Logto or Logto Cloud? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im looking to use DO as sessions, but I'd use the logto package if it works.
Beta Was this translation helpful? Give feedback.
All reactions