OpenCloud
Set up Pocket ID authentication for OpenCloud
OpenCloud ships with a built-in identity provider (IDP), but it can be replaced with an external OIDC provider. This guide walks through replacing the internal IDP with Pocket ID.
The following example variables are used and should be replaced with your actual URLs:
cloud.example.com— URL of your OpenCloud instanceid.example.com— URL of your Pocket ID instance
Key requirements
OpenCloud enforces a few constraints on external OIDC providers:
- All clients must be public clients using PKCE (Authorization Code + PKCE flow). There are no confidential clients.
- Desktop and mobile clients use predefined, hardcoded
client_idvalues (OpenCloudDesktop,OpenCloudAndroid,OpenCloudIOS). These must be registered in Pocket ID with those exact IDs — see Desktop and Mobile Clients. - The provider must include a role claim in the access token. OpenCloud maps claim values to its internal roles (
opencloudAdmin,opencloudSpaceAdmin,opencloudUser,opencloudGuest).
Step 1 — Create groups in Pocket ID
Create the following four groups in Pocket ID under Groups → Create group. These are used both for access control and role assignment.
| Group name | Purpose |
|---|---|
opencloud_admins | Maps to the opencloudAdmin role |
opencloud_spaceadmins | Maps to the opencloudSpaceAdmin role |
opencloud_users | Maps to the opencloudUser role |
opencloud_guests | Maps to the opencloudGuest role |
After creating each group, open it and go to Custom Claims. Add a claim with the key opencloud_role and the value from the table below:
| Group | Claim key | Claim value |
|---|---|---|
opencloud_admins | opencloud_role | opencloudAdmin |
opencloud_spaceadmins | opencloud_role | opencloudSpaceAdmin |
opencloud_users | opencloud_role | opencloudUser |
opencloud_guests | opencloud_role | opencloudGuest |
Every user must belong to at least one of these groups. Users without a group will authenticate but receive an error inside OpenCloud.
Step 2 — Web client
- In Pocket ID go to OIDC Clients → Create client. Name it, for example,
Opencloud. - Set a logo if you like.
- Add the following Callback URLs:
- Add the following Logout Callback URL:
- Enable Public Client.
- Enable PKCE.
- Optionally restrict access under Allowed Groups to the four opencloud groups created in Step 1.
- Save and copy the Client ID (a UUID) — you will need it in Step 4.
No client secret is needed. OpenCloud's web frontend is a public SPA and will never send a
client_secret.
Step 3 — Desktop and Mobile Clients
OpenCloud's desktop and mobile clients send hardcoded client_id values that cannot be changed in the application. You must register clients in Pocket ID with those exact IDs.
Pocket ID's standard Create client form auto-generates a UUID as the client ID. To register clients with custom IDs, insert them directly into the Pocket ID PostgreSQL database. Once created, they appear normally in the Pocket ID web UI and can be managed from there like any other client.
Get the admin user UUID first:
Insert the three clients:
After inserting, the three clients appear in Pocket ID → OIDC Clients. From the web UI you can now:
- Update callback URLs
- Add a logo
- Set Allowed Groups to restrict access to the four opencloud groups
To restrict access via SQL instead:
Step 4 — Configure OpenCloud
Set the following environment variables on your OpenCloud deployment. Replace id.example.com with your Pocket ID URL and <CLIENT_ID> with the UUID copied from Step 2.
Content Security Policy
If you use a CSP config file, allow connections to your Pocket ID instance:
The WebSocket entry must use
wss://id.example.com— no trailing slash, and no embeddedhttps://prefix.
Troubleshooting
"Logging you in — Please wait, you are being redirected" (stuck)
The OIDC callback is reached but the token exchange fails silently. Verify that the Pocket ID client has both Public Client and PKCE enabled. A confidential client without PKCE causes the redirect to complete but the code exchange to fail because the browser never sends a client_secret.
"This could be because of a routine safety log out, or because your account is either inactive or not yet authorized for use"
The user authenticated successfully but OpenCloud could not assign a role. Check:
- User is not in any opencloud group — add the user to one of the four groups in Pocket ID.
opencloud_rolecustom claim is missing — verify each group has the claim configured as described in Step 1.- Claim name mismatch — confirm
PROXY_ROLE_ASSIGNMENT_OIDC_CLAIMequalsopencloud_role.
Desktop or mobile client receives "unauthorized_client"
The predefined client ID (OpenCloudDesktop, OpenCloudAndroid, or OpenCloudIOS) does not exist in Pocket ID. Follow Step 3 to register it.
Users can log in but see an empty file list or permission errors
PROXY_USER_OIDC_CLAIM must identify users uniquely and consistently across logins. preferred_username works well with Pocket ID. Avoid email if users are allowed to change their email address in Pocket ID.