-
Hi everyone,
I'm trying to set up authentication for a simple web application and I'm running into some confusion around OAuth/OIDC best practices with Cloudron.
My Setup:
- Frontend: Static website served by Surfer (Cloudron app)
- Backend: n8n workflows for API endpoints
- Authentication: Want to use Cloudron's built-in OIDC
My Intended Flow:
- User clicks login on frontend (JavaScript SPA)
- Redirect to Cloudron OIDC authorization endpoint
- User authenticates with Cloudron
- Frontend receives authorization code/token
- Frontend passes token to n8n backend for verification
- n8n validates token with Cloudron and proceeds with authorized operations
The Problem:
I understand that exposing a client_secret in JavaScript is a security anti-pattern. For single-page applications, the recommended approach is to use a "public client" with PKCE (Proof Key for Code Exchange) instead of client secrets.However, when I look at Cloudron's OIDC app configuration, I don't see any option to:
- Configure a client as "public" (no secret required)
- Enable PKCE support
- Set the client type appropriately for SPAs
My Questions:
- Does Cloudron's OIDC implementation support public clients with PKCE?
- If not, what's the recommended pattern for SPA authentication with Cloudron?
- Should I be using a different flow entirely (like having n8n handle the OAuth dance server-side)?
- Is installing a separate Keycloak instance the only way to get proper SPA OIDC support?
I'm hoping there's a standard way to handle this that I'm missing. The alternative of putting authentication logic entirely in n8n (server-side) seems to complicate the frontend significantly.
Any guidance on the proper architecture pattern here would be greatly appreciated!
Additional Context:
- All components are running on the same Cloudron instance
- I'd prefer to stick with Cloudron's built-in capabilities if possible
Thanks in advance!
-
J james marked this topic as a regular topic on
-
J james moved this topic from Support on
-
-
We use https://github.com/panva/node-oidc-provider internally and that is supposed to support PKCE. Not sure yet how to use it to test what this needs.
Until that is working, the options are a keycloak instance or a small backend which gives the SPA some kind of session while handling the oidc login bits.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login