Using Decidim as an OAuth provider for other applications

Learn how participants can sign in to other city or organization apps with their Decidim account, which Decidim settings and OAuth application fields control it, and where integrations usually fail.

On this page

Can Decidim sign participants into other city apps?

Yes, Decidim can act as an OAuth 2.0 authorization source for other applications. You create OAuth applications in the Decidim admin panel, and each connected app then sends participants to Decidim to sign in and returns with an authorization code that it exchanges for a token. The supported Decidim-to-Decidim OAuth 2.0 login is documented on the Decidim social providers page, which is the first document to read before you scope the work. Note that this is the documented pattern for OAuth 2.0 login. Do not assume it provides full OpenID Connect behavior, such as a standard ID token or discovery document, unless the docs for your exact Decidim version confirm it.

The city or organization's separate app must implement a standard OAuth client flow itself. That means registering the app, configuring its redirect URIs to match the ones set on the Decidim OAuth application exactly, requesting the scopes it needs, handling the authorization code exchange and storing its own session. Confirm with your development team which endpoints the app will call, which scopes Decidim exposes for login and which user attributes come back in the profile response for your Decidim version. Also confirm whether the app needs a client secret or is a public client that relies on PKCE, since the sibling API topic covers PKCE for public clients in more depth.

Before you commit to this design, test it on a staging instance with a test account and a test client. Check that a participant who is unverified or blocked in Decidim cannot obtain a session in the other app, and decide who owns the account record in the city app when a user first signs in. Confirm the version in use against the Decidim releases page, since endpoints and scope names can change between minor versions and the 0.31 and 0.32 lines differ in their supported Ruby and Rails versions.

What you need before creating the OAuth application

Decidim can act as the identity source for other applications only when the platform version, hosting, and client application are in place before anyone opens the admin panel. The cards below cover what to confirm on the Decidim side, what the consuming application needs, and who answers for participant data during the rollout.

A supported Decidim version

Confirm your instance runs 0.32.x or 0.31.x, the two minor branches that receive security updates until version 1.0. Instances on 0.30.x or earlier are outside that support window, so an OAuth integration built on them would inherit unpatched risk. Check the running version before you plan redirect URIs or scopes, because the admin screens and upgrade path depend on it.

Decidim security policy

A working HTTPS Decidim instance

The Decidim instance must be reachable over HTTPS at the public hostname that other applications will call. Confirm that the admin account can sign in, that outgoing email works, and that the organization's public URL matches the hostname you intend to register. Mismatched hostnames are a common reason redirect checks fail later in testing.

Decidim installation docs

A consuming application and its OAuth library

Identify the application that will accept Decidim sign-ins and record the OAuth or OpenID client library it uses, along with its version. Confirm that the library supports the authorization code flow and lets you set the redirect URI, client ID and client secret through configuration. Without this, you cannot test the callback against the Decidim authorization endpoint.

DNS and certificates on both sides

Both the Decidim host and the consuming application need DNS records and valid TLS certificates that browsers trust. Certificate chains issued by an internal authority must be installed on every client that performs the redirect. Check renewal dates and confirm which team owns each certificate, since an expired certificate on either side breaks sign-in for every participant at once.

A named owner for participant data

Name one person or role who decides which Decidim profile fields the consuming application may read, how long it may store them, and how it handles deletion requests. Participants use the same account across both systems, so the owner must approve the data flow before go-live. Record that decision in writing, because the privacy and compliance review will ask for it.

A test organization or staging instance

Set up a test organization or a separate staging instance to create the first OAuth application and run sign-in checks. Use test accounts rather than real participant accounts, and keep the staging redirect URIs separate from production values. This lets you confirm scopes and callback behavior before any real participant is redirected.

How an OAuth sign-in moves between the city app and Decidim

The flow starts when a participant chooses sign in on the city app and the browser is sent to Decidim's authorization endpoint with the client ID and redirect URI. Decidim checks both against the OAuth application registered in its admin panel before it returns an authorization code through the browser. The city app then exchanges that code for an access token over the back channel, where the client secret is checked, and uses the token to request user information. The two boxes mark the trust boundary: the client_secret is sent only from the city app server to Decidim, never through the browser.

Sign-in sequence showing where client ID, client secret and redirect URI are checked.

Which Decidim login path fits your app

Use this path when the application you want to sign in to is another Decidim instance, for example a sister platform run by a neighboring municipality or a separate participation site for a different department. Decidim ships a Decidim-to-Decidim OAuth 2.0 login provider, so participants can reuse their account from the instance they already know without a separate identity system.

  • Configuration location: The provider is enabled in the instance's social login settings, either globally or for a single organization.
  • Trust between instances: Each side must register the other as a client and agree on the exact redirect addresses, so a mismatch will block sign-in.
  • Participant data: Confirm which profile fields the receiving instance gets and whether it can match accounts by email or by a stable identifier.
  • Verification: Decide whether a sign-in from the other instance counts as verified for voting or signing, since the receiving instance may need its own authorization step.
  • Version alignment: Check that both instances run versions whose docs describe the same provider settings.

The social providers documentation for your installed version is the authority on setting names and attributes. Confirm them before you plan the configuration.

Configuring the OAuth application in the Decidim admin panel

This sequence registers Decidim as the OAuth 2.0 provider for one consuming application, so participants can sign in with their Decidim account. It ends with a verified sign-in in which the app exchanges an authorization code for a token. Each step closes with a check the implementation team can record.

  1. Confirm the organization and admin role

    An administrator of the Decidim organization whose participant accounts will be used for sign-in does this step. Confirm the organization in which participants hold accounts, because the OAuth application and its users are scoped to that organization. Check that the account has rights to manage OAuth applications, and ask the platform owner to grant them if it does not. Confirm the exact menu location in the admin documentation for the Decidim version you run, since 0.31 and 0.32 differ in some areas. The step is complete when the OAuth application section is visible in the admin panel.

  2. Create the OAuth application in the admin panel

    Create a new OAuth application in the admin panel. Give it a name that participants will recognize on the consent screen, such as the city service they are signing in to. Enter the redirect URI exactly as the consuming app registered it, including scheme, host, path and any trailing slash, because a mismatch will block the flow. Save the application. The step is complete when the application appears in the list with a client ID and the redirect URI matches the one in the consuming app's registration.

  3. Record the client ID and secret

    Copy the client ID and client secret into the organization's secrets store, such as a password manager or secrets vault, and restrict read access to the people and services that need it. Do not paste the secret into tickets, chat, a repository or a shared document. Confirm whether your Decidim version shows the secret again after creation, and if it does not, plan for regeneration as a controlled change. The step is complete when the secret is stored under a named entry and the consuming app's deployment is able to reference that entry.

  4. Select only the scopes the app needs

    Choose the minimum set of OAuth scopes the consuming app needs to identify the participant, and leave out any scope that allows changes to Decidim data. A sign-in integration usually needs identity information only. Confirm the scope names and their meaning in the Decidim OAuth documentation for your version before you select them. Write-capable scopes belong to a separate automation design. The step is complete when the scopes are saved on the application and a review of the list shows only what the app's design document requires.

  5. Configure the consuming app's OAuth client

    In the consuming application, configure an OAuth 2.0 client with the Decidim instance's authorization and token endpoints, the client ID and secret from the secrets store, the same redirect URI registered in step two, and the scopes chosen in step four. Confirm the endpoint paths against your instance's documentation rather than assuming them. The step is complete when a sign-in attempt from the app redirects the browser to the Decidim login and consent screen, and after approval the browser returns to the redirect URI with an authorization code in the query string.

  6. Run a test sign-in with a test participant

    Sign in with a dedicated test participant account, not a staff or personal account, and use a non-production instance if one is available. Confirm that the consuming app exchanges the authorization code for an access token on the server side and receives the expected user identifier and attributes. Then attempt a sign-in with a deliberately wrong redirect URI and confirm that Decidim refuses it. Remove or disable the test account afterwards. The step is complete when the token exchange succeeds, the profile loads in the app, and the mismatched redirect fails, with each result recorded in the change log.

Which Decidim account fields map to the consuming app

This table compares each Decidim account field with how the consuming app should store, match or avoid it. Read the handling column as the default, and confirm the notes against the scopes and claims your Decidim version returns before you build the user record. The main takeaway is to key accounts on a stable identifier and treat anything users can edit as display data.

Decidim fieldStore in the consuming appNotes for matching and scopes
Stable user identifierStore as the link key for the Decidim accountConfirm it is returned under your granted scopes. Never key accounts on email or nickname.
NicknameStore as a display handle, refreshed on each sign-inNicknames can change, so do not use them for matching. Confirm whether your scope exposes them.
NameStore only if a feature needs it, and let users edit itNames are often self-entered and unverified. Check whether your scope returns them.
Email addressStore for notifications and mark as unverified until confirmedUse for matching only when both systems confirm ownership. Confirm the scope exposes it at all.
Verification statusStore a yes or no flag or level only if access decisions need itDo not copy census records or identity documents. Confirm whether verification data reaches OAuth clients.
Avatar, bio and other profile contentDo not store unless a documented feature needs itProfile content is user-controlled and may change or be removed. Fetch it on demand where possible.
Access and refresh tokensNever store in the user recordKeep tokens in server-side session storage or a secrets store, and revoke them when the account is unlinked.
Existing local accountsLink after explicit confirmation on first sign-inMatch on the stable identifier first. Merge on a shared email only when both sides confirm it, otherwise prompt the user to link.

Controls for redirect URIs, secrets and scopes

An OAuth provider is only as safe as the applications registered with it and the people allowed to change them. The controls below cover what Decidim accepts, how the consuming app stores and checks credentials, and who holds the admin rights to change them. Review each one with your security team before the first participant signs in.

Exact-match HTTPS redirect URIs

Register each redirect URI exactly as the consuming application will call it, including path and trailing slash, and use HTTPS only. Loose or wildcard-style redirect targets let an attacker send an authorization code to a host they control. For each application, confirm the list in Decidim contains only the production callback and, if needed, a single staging callback. Remove test URIs once the integration is signed off.

Client secrets out of code and logs

Store the client secret in the consuming application's secret manager or environment, never in a repository, container image or front-end bundle. Make sure request logs, error reporters and debug output do not print the authorization code, the token exchange request body or the secret. Check your CI pipeline logs as well, because a secret pasted into a build variable often ends up there.

Minimum scopes per application

Grant each OAuth application only the scopes its sign-in flow needs. A login-only app usually needs identity data, not write access to proposals or meetings. Review the scope list whenever the application's features change, and document why each scope is granted so that the next reviewer does not have to guess.

Secret rotation after staff changes

Rotate the client secret when someone who knew it leaves the team, changes role, or when a secret may have been exposed. Plan the rotation so the consuming app can accept the new secret before the old one is revoked, and record who performed it and when. Ask Decidim's documentation or your own test instance how the admin panel handles regenerating a secret before you rely on this step.

Admin rights to create and edit applications

Creating or editing an OAuth application is a trust decision, because it determines where participant identities can be sent. Limit this right to a small named group of platform administrators in the Decidim admin panel, and review that list on a schedule. Keep changes traceable to a person, so a new redirect URI or scope can be matched to a ticket or change approval.

Session, token lifetime and failed sign-in logs

In the consuming application, bind the local session to the Decidim login and end it when the token expires or is revoked. Check token lifetime on every protected request rather than assuming the first login stays valid. Log failed sign-ins with timestamp, application and error type, but never write access tokens, refresh tokens or authorization codes to those logs.

How to test sign-in before participants see it

Run every sign-in path on a staging Decidim instance before any participant sees the consuming application. Create a test participant for each registration state your organization uses, for example a confirmed account, an account that has not confirmed its email, and an account that has been blocked or deleted. For each one, attempt the authorization flow from the consuming app and record what the app receives. Then test the failure cases on purpose: revoke the OAuth application's access for a test user and confirm the consuming app drops its session, enter a wrong client secret and confirm the token exchange fails cleanly, and register a redirect URI that does not match the one the app sends and confirm Decidim rejects the request. Confirm the exact behavior against your Decidim version, since the 0.32 and 0.31 branches are the ones currently receiving security updates.

Include a participant who is not verified and a token that expires during an active session. Use an account that has not completed any authorization method your organization requires, and check whether the consuming app still grants access or sends the user back to Decidim. For expiry, let a session run past the token lifetime and confirm the app refreshes or re-prompts without losing the user's work. Confirm the token lifetime and refresh behavior in your own configuration rather than assuming a default.

Test Decidim's wider verification and authorization settings separately, because they can change what a signed-in user is allowed to do in the consuming app even when sign-in succeeds. A participant can authenticate correctly and still be blocked from an action that depends on a verified identity, or the app may read a different set of user attributes than you expect. Repeat the test matrix with verification required and not required, and record which attributes and permissions the app actually receives for each case. Keep the results with the change record so the security or compliance team can review them.

Why redirect, token and profile errors happen

This table lists the failures most often seen when another application signs participants in through Decidim, with the likely cause, the check that confirms it and the fix. Read each row against the error the user or log shows, then work through the checks in order, since several failures produce similar symptoms.

FailureLikely causeCheck that confirms itFix
Redirect URI mismatchThe redirect URI registered in the Decidim OAuth application differs from the one the consuming app sends, often by scheme, host, port, path or trailing slash.Compare the registered URI in the Decidim admin panel with the redirect_uri parameter in the authorization request, character by character.Register the exact callback URL the consuming app uses, including protocol and path, then retry the sign-in.
Wrong or rotated client secretThe secret was copied incorrectly, regenerated in Decidim, or still held in an old configuration file or secret store.Check the token exchange response for an invalid client error and confirm the secret value and deployment it came from.Store the current secret in the consuming app's secret manager, redeploy, and remove old copies from configuration files.
Scope requested but not grantedThe consuming app asks for a scope the OAuth application was not configured to allow, so the granted scope is narrower than expected.Compare the scope parameter sent with the scope field in the token response and the scopes enabled on the application.Request only the scopes the application holds, or update the application's scopes and have the participant authorize again.
Clock skew and token timingThe consuming server's clock or time zone is out of step, so tokens appear expired or not yet valid, or timestamps are compared in the wrong zone.Check system time on both servers against a trusted time source and compare the token's issued and expiry times with the consuming app's logs.Enable time synchronization on all hosts and compare timestamps in UTC inside the consuming app.
Missing HTTPS or mixed contentDecidim or the consuming app is served over plain HTTP, or the redirect and profile calls mix HTTP and HTTPS, which browsers and some libraries block.Open the Decidim and consuming app URLs and check the browser console for mixed content warnings and the scheme in each redirect.Serve both applications over HTTPS with valid certificates, and make the configured site URLs use HTTPS.
Duplicate accounts from email matchingThe consuming app links Decidim identities to local accounts by email, so a changed or unverified address creates a second account.Search the consuming app's user table for repeated emails and compare the stored Decidim identifier for each account.Match on the stable Decidim user identifier returned in the profile, and review or merge duplicates with the owning team.
Endpoints changed after a Decidim upgradeA minor version upgrade altered routes, paths or response fields, so the consuming app calls an address or reads a key that no longer exists.Compare the consuming app's configured authorization, token and profile URLs with the release notes and the upgraded instance's endpoints.Update the endpoint configuration in the consuming app, test sign-in on staging, and upgrade one minor version at a time as Decidim's update guide advises.

Questions buyers ask before outsourcing this integration

Can our own team set up Decidim as an OAuth provider without a partner?

Yes, if your team already runs Decidim and has someone comfortable with Rails configuration, OAuth 2.0 and the Decidim admin panel. The core steps are creating an OAuth application in the admin panel, registering redirect URIs, choosing scopes and configuring each client app to match. The harder part is usually not the first client but the second and third: each application needs its own redirect URIs, secrets and tests, and a participant-facing sign-in flow has to be checked end to end. Decide early whether a partner should cover that testing and the security sign-off, or whether your team will do it.

What makes the effort for a Decidim OAuth integration grow?

Effort grows with the number of client applications, the scopes each one requests, and how existing accounts are handled. Each extra application adds its own redirect URIs, client credentials and test cases. Scopes determine what data a client can read, so each one needs a review. Account merging is often the largest driver: if city or organization apps already hold user records, you must decide how they map to Decidim accounts and what happens to duplicates. Staging environments, separate test participants and any planned Decidim minor upgrades add further work.

What does our organization need to provide for this work?

You will need admin access to the Decidim instance, a named owner for each client application who can approve its redirect URIs and scopes, and test participant accounts that cover the cases you care about, such as verified and unverified users. You also need a security sign-off path, since someone in your organization should approve the scopes and the handling of client secrets before anything goes live. Ask any partner to list these inputs in the written scope so that delays are visible and assigned.

How long does a Decidim OAuth integration take?

The duration depends on the scope agreed in writing, not on a standard figure. A single application with one set of scopes and no account migration is a much smaller job than several applications with shared identity rules, staging copies and a planned upgrade. Ask for the timeline to be tied to named deliverables: configured applications, tested sign-in flows, documented scopes and a handover of credentials. Timelines also depend on how quickly your app owners and security reviewers respond, so confirm those commitments before work starts.

Does Decidim support every OpenID Connect feature?

Do not assume it does. Decidim's documented OAuth 2.0 login for Decidim-to-Decidim use is the starting point, and the exact behavior around OpenID Connect features such as ID tokens, discovery endpoints, token claims and logout should be checked against the current Decidim documentation for the version you run. Ask for a written list of the flows your client applications need, then test each one on a staging copy. Where a feature is missing, the options are a different identity provider in front of Decidim or a custom solution, and both change the scope and cost.

What changes for OAuth clients after a Decidim minor upgrade?

Decidim asks implementers to upgrade one minor version at a time and to follow each release's upgrade instructions, because some releases change database structures. OAuth applications, their redirect URIs and the client configuration live in the platform data, so they should survive the upgrade only if the migration is tested. Before each upgrade, back up the database, rerun the sign-in tests for every client application and confirm the scopes still behave as expected. Include this retesting in the scope, because each client app is a dependency that can break.

Who maintains the integration after go-live?

Your organization owns the Decidim instance and the client apps, so ongoing maintenance needs a named owner on both sides. Expect recurring work for security updates, credential rotation, new client applications and each Decidim upgrade. Decidim supports only the last two minor versions with security updates, so an unsupported version forces an upgrade before the OAuth setup can be trusted. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and a quote should separate the one-time build from these recurring items.

How DeployOpen scopes and supports Decidim OAuth integrations

DeployOpen treats Decidim as an OAuth provider as a scoped integration, not a switch in the admin panel. We agree the applications, redirect URIs, scopes and test cases in writing, build and test them in your infrastructure, and hand over documentation your team can run after go-live.

How we scope

  • Inventory every application that will accept Decidim sign-in and record its owner and environment.
  • Agree which redirect URIs, client types and scopes each application needs before any OAuth app is created.
  • Confirm with your team which profile data each application may read, and document the decision in the written scope.

How we build

  • Create the OAuth applications in the Decidim admin panel and set up each client against its agreed redirect URIs.
  • Test authorization code flows, token expiry, revocation and sign-out for each client on a staging instance first.
  • Run security checks on the authorization endpoints and redirect handling as part of the build, and fix findings before release.

How we hand over

  • Deliver a runbook covering client registration, secret rotation, redirect URI changes and scope additions.
  • Document the test cases used, the results and the open findings, so your security and compliance teams can review them.
  • Walk your platform and security teams through the setup and confirm who owns each OAuth application after handover.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, Decidim upgrades and continuous testing are available as retainers, so OAuth clients can be retested after each release.
  • Ask for a written quote based on your application list, environments and scope changes to see which costs are one-time and which recur.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.