Nextcloud is an open-source storage and collaboration platform. You can allow users to sign in to your Rocket.Chat workspace with their Nextcloud credentials. Setup involves alternating between your Nextcloud admin settings and your Rocket.Chat admin panel, so keep both open in separate tabs.
Important
Per Nextcloud's own documentation, Nextcloud's OAuth2 implementation does not support scoped access. Every issued token has full read and write access to the user's complete Nextcloud account, including stored files. Nextcloud states that, without scoped access, it is "not recommended to use a Nextcloud instance as a user authentication service." Review this tradeoff before proceeding.
Prerequisites
Administrator access to your Nextcloud server
Administrator access to your Rocket.Chat workspace
Step 1: Add an OAuth 2.0 client in Nextcloud
Sign in to your Nextcloud server as an administrator.
Go to Settings → Administration → Security. Do not confuse this with Personal Security Settings, which is for your own password.
Scroll to OAuth 2.0 clients and locate the Add client row.
Enter a Name (for example, Rocket.Chat). You will provide the Redirection URI in Step 3.
Leave this page open. You will return to it in Step 3.
Step 2: Get the callback URL from Rocket.Chat
Sign in to your Rocket.Chat workspace as an administrator.
Go to Manage → Workspace → Settings → OAuth.
Expand the Nextcloud section.
Copy the value of Nextcloud Callback URL. It looks like
https://your-domain/_oauth/nextcloud.
Step 3: Add the redirect URI and capture credentials
Return to your Nextcloud OAuth 2.0 clients page.
Paste the callback URL you copied from Rocket.Chat into the Redirection URI field.
Select Add. A new row appears with the Client Identifier and Secret.
Note the Client Identifier and reveal and copy the Secret. You will paste these into Rocket.Chat in Step 4.
Step 4: Configure Nextcloud OAuth in Rocket.Chat
Back in Rocket.Chat, in the same OAuth > Nextcloud section:
Turn OAuth Enabled on.
Enter the following values:
Nextcloud Server URL: the base URL of your Nextcloud instance, for example
https://cloud.example.orgNextcloud Id: the Client Identifier from your Nextcloud OAuth client
Client Secret: the Secret from your Nextcloud OAuth client
Optional: customize the sign-in button using Button Text, Button Text Color, and Button Color.
Select Save changes.
Accessibility note
Changing the button text or background color may produce combinations that fail WCAG contrast requirements. Verify your chosen colors against a contrast checker before saving.
Verify the setup
Sign out of your workspace.
On the sign-in page, confirm that the Sign in with Nextcloud button (or your custom button label) appears.
Select it and complete the Nextcloud sign-in flow. You should be returned to your workspace and signed in.
Troubleshooting
Sign-in fails with a redirect or URI error
The Redirection URI in Nextcloud and the Nextcloud Callback URL in Rocket.Chat are not identical. Re-copy the value from Rocket.Chat and paste it into Nextcloud exactly as shown, including the scheme and trailing path.
The Sign in with Nextcloud button does not appear
Confirm that OAuth Enabled is on, that Nextcloud Server URL, Nextcloud Id, and Client Secret are filled in, and that you saved changes. A hard refresh of the sign-in page may be needed.
Sign-in redirects to a 404 or a Nextcloud login loop
Check that your Nextcloud Server URL is the base URL only, with no trailing slash and no /index.php or /apps/... path appended. If your Nextcloud instance is not configured with pretty URLs, consult Nextcloud's OAuth2 documentation for endpoint requirements.