Nextcloud
This guide explains how to set up Single Sign-On (SSO) between SmartLink and Nextcloud using the Social Login plugin with OpenID Connect.
Prerequisites
- Nextcloud version 20 or higher
- Administrator access to Nextcloud
- Application configured in SmartLink with OpenID Connect
- Social Login plugin installed on Nextcloud
Installing the Social Login plugin
Via the Nextcloud interface
- Log in to Nextcloud as an administrator
- Go to Settings → Apps
- Search for "Social Login" in the Integration category
- Click on Download and enable
Via the command line
cd /var/www/nextcloud
sudo -u www-data php occ app:install sociallogin
sudo -u www-data php occ app:enable sociallogin
Configuration in SmartLink
1. Create the application
- Log in to SmartLink as an administrator
- Go to Applications → Add
- Search for "Nextcloud" or create a custom application
- Configure the basic information:
- Name: Nextcloud
- URL:
https://your-nextcloud.example.com - Icon: Choose the Nextcloud icon
2. Configure OpenID Connect
- In the Authentication tab of the application
- Select OpenID Connect as the authentication type
- Note the following information:
- Client ID:
nextcloud-xxxxxx - Client Secret:
secret-xxxxxx - Issuer URL:
https://your-smartlink.link.vaultys.org/api/oidc/[appid] - App ID:
[appid](unique identifier of the application in SmartLink)
- Client ID:
3. Configure Redirect URLs
In the Allowed Redirect URLs section, add:
https://your-nextcloud.example.com/apps/sociallogin/custom_oidc/smartlink
Note: The
[appid]will be automatically generated when creating the application in SmartLink.
4. Configure Scopes
Ensure the following scopes are enabled:
openidprofileemailgroups(optional, for group synchronization)
Configuration in Nextcloud
1. Accessing Social Login settings
- Log in to Nextcloud as an administrator
- Go to Settings → Administration → Social login
2. General Configuration
In the General Settings section:
- ✅ Allow self-registration: Enable if you want to automatically create accounts
- ✅ Create a new account if it does not exist: Recommended
- ✅ Update user profile on each login: To synchronize information
- ⬜ Disable Nextcloud authentication: Keep disabled to maintain local admin access
- ✅ Allow login with email: To facilitate user access
Login button: Log in with SmartLink
3. Add a Custom OpenID Connect provider
Click on + Custom OpenID Connect and configure:
- Internal Identifier:
smartlink - Display Name:
SmartLink SSO - Authorization URL:
https://your-smartlink.link.vaultys.org/api/oidc/[appid]/authorize - Token URL:
https://your-smartlink.link.vaultys.org/api/oidc/[appid]/token - User Info URL:
https://your-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo - Logout URL:
https://your-smartlink.link.vaultys.org/logout - Client ID:
[Copy from SmartLink] - Client Secret:
[Copy from SmartLink] - Scope:
openid profile email groups
4. Attribute Mapping
User field mapping configuration:
- User ID:
suboremail - Display Name:
name - Email:
email - Quota: Leave blank or configure as needed
- Groups:
groups(if using group synchronization)
5. Advanced Settings (optional)
- Default Groups: Automatically assigned Nextcloud groups
- Button on login page: Button style (0 = standard button)
- Allow only specific groups: List of allowed SmartLink groups
Advanced Configuration
Group Synchronization
To automatically synchronize SmartLink groups with Nextcloud:
- In SmartLink, enable the
groupsscope for the application - In Nextcloud Social Login, configure group mapping:
Group claim: groups - Enable "Create groups if not existing"
Automatic Provisioning with SCIM (optional)
For complete user and group provisioning, you can also configure SCIM:
- Install the User provisioning app on Nextcloud
- Configure SCIM in SmartLink (see SCIM guide)
- Nextcloud SCIM URL:
https://your-nextcloud.example.com/apps/scimserviceprovider
Configuration via Environment Variables
For automated deployments, you can configure Social Login via config.php:
'sociallogin' => [
'auto_create_groups' => true,
'update_profile_on_login' => true,
'providers' => [
'smartlink' => [
'displayName' => 'SmartLink SSO',
'apiBaseUrl' => 'https://your-smartlink.link.vaultys.org',
'authorizeUrl' => 'https://your-smartlink.link.vaultys.org/api/oidc/[appid]/authorize',
'tokenUrl' => 'https://your-smartlink.link.vaultys.org/api/oidc/[appid]/token',
'userInfoUrl' => 'https://your-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo',
'logoutUrl' => 'https://your-smartlink.link.vaultys.org/logout',
'clientId' => 'nextcloud-xxxxxx',
'clientSecret' => 'secret-xxxxxx',
'scope' => 'openid profile email groups',
'userMapping' => [
'id' => 'sub',
'name' => 'name',
'email' => 'email',
'groups' => 'groups'
]
]
]
],
Configuration Testing
1. Connection Test
- Log out of Nextcloud
- On the login page, click on "Log in with SmartLink"
- You should be redirected to SmartLink
- Authenticate with your SmartLink credentials
- You should be redirected back to Nextcloud and automatically logged in
2. User Information Verification
- Go to Settings → Personal Information
- Verify that the information is correctly synchronized:
- Display name
- Email address
- Groups (if configured)
3. Logout Test
- Click on your profile → Logout
- Verify that you are also logged out of SmartLink
Troubleshooting
"Invalid redirect URI" Error
Issue: The redirect URL is not correctly configured
Solution:
- Verify that the URL in SmartLink matches exactly:
https://your-nextcloud.example.com/apps/sociallogin/custom_oidc/smartlink - Pay attention to the protocol (http vs https) and trailing slash
"Invalid client credentials" Error
Issue: Incorrect client credentials
Solution:
- Check the Client ID and Client Secret in SmartLink
- Ensure there are no extra spaces during copy-pasting
- Regenerate the secret if necessary
Groups Not Synchronized
Issue: SmartLink groups are not appearing in Nextcloud
Solution:
- Check that the
groupsscope is enabled in SmartLink - In Social Login, ensure that group mapping is configured:
groups - Enable "Create groups if not existing"
- Verify that the user belongs to groups in SmartLink
"Could not fetch user info" Error
Issue: Nextcloud cannot retrieve user information
Solution:
- Check the UserInfo URL:
https://your-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo - Test the endpoint with curl:
curl -H "Authorization: Bearer TOKEN" https://your-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo - Check SmartLink logs for authorization errors
User Created but Unable to Login
Issue: Account is created but user cannot log back in
Solution:
- Verify the user ID mapping (using
subis recommended) - Ensure the ID is unique and stable
- Check Nextcloud logs:
tail -f /var/www/nextcloud/data/nextcloud.log | grep sociallogin
Security
Recommendations
- Mandatory HTTPS: Always use HTTPS for Nextcloud and SmartLink
- Secure Secrets: Store the Client Secret securely
- IP Restriction: If possible, limit access to OAuth endpoints by IP
- Secret Rotation: Regularly change the Client Secret
- Audit Logs: Enable and monitor authentication logs
Disabling Local Authentication
To enforce the use of SSO only:
- In Social Login, enable "Disable Nextcloud authentication"
- ⚠️ Caution: Always keep a local admin account for emergencies:
sudo -u www-data php occ user:add admin --password-from-env