Skip to main content

How to Enable Google Sign-In for Didit Authentication via API

One API call turns on Google sign-in for Didit Authentication. Send your OAuth app credentials and register the returned redirect URI at Google, or use Didit's test app on a sandbox application. The secret is write-only.

How to Enable Google Sign-In for Didit Authentication via API

Contents

In this guide

Jump to the part you need.

This page is for developers who run Didit Authentication and want Google as a sign-in method, configured from code rather than a console page. One PUT to methods/google/ turns it on, with your own Google OAuth app's client_id and client_secret, or with Didit's test app on a sandbox application. Sign-in is free for the first 50,000 monthly active users. The caveat: the secret is write-only, and switching the method on with no stored credentials answers {"credentials": "required"}.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

Google sign-in for Didit Authentication: your own OAuth app versus Didit's test app
DecisionYour own Google OAuth appDidit test app, credential_source: "didit_test"
Where it worksSandbox and live applicationsSandbox applications only
What you sendclient_id and client_secret from your Google projectenabled: true and credential_source: "didit_test"
What comes backThe method as it now stands, including the callback_uri200 with configured: true, or sandbox_only or unavailable
Whose consent screen people seeYoursDidit's test app
Best forLive sign-ins and launchFinishing a setup and proving the flow before you own an app
Setup costNothing for the API callNothing, and the sandbox is never billed

Start free in the sandbox at business.didit.me, no sales call. Developers connecting Didit to an AI assistant can use the Didit MCP server, which reaches the same management routes. The product itself is Didit Authentication, and the price list is on didit.me/pricing.

What this setup gives you, and the route we recommend

After the call succeeds, Google appears as a button on your hosted sign-in page at https://<slug>.auth.didit.me/sign-in, next to whatever else you enabled: passkeys, email code, Microsoft, Apple, GitHub. If you built your own screens with sign_in_ui: "own", the same switch makes Google available to the JSON endpoints those screens call. Either way, after a person signs in your app receives a one-time code, exchanges it at POST /token/ within 60 seconds, and your backend verifies the resulting access token.

Enabling Google does not verify anyone's identity. Didit Authentication signs your own users into your application. Identity verification is a separate product with its own results, and signing in never approves a verification or authorizes a payment.

Our recommendation: prove the method in a sandbox application with Didit's test app first, then register your own Google OAuth client before you go live. Test apps never serve live sign-ins, so that second half of the work has to happen anyway, and doing it in this order means you debug one thing at a time. Didit serves 4,000+ companies, and the rule we give every team applies here: a configuration that worked in sandbox is not a live configuration until you have read it back on the live application.

Biometric Authentication by Didit
Didit Authentication covers sign-in methods and the flows around them. Google joins the method list only after the switch is on.

Prerequisites

  • A Didit account with an application. Every Sandbox application has Authentication on from the start. A Live application turns it on from the Products page of the console, and until it is on, every runtime route for that application returns 404.
  • One credential that may call the Authentication management API: an API key of the application (full access, or scoped with the authentication resource at read or write), an owner-approved grant with didit:management, or a console session.
  • Your organization ID and application ID, which together build the management base URL.
  • For your own app: a Google OAuth client for a web application, with its client ID and client secret ready to send. The Didit documentation only requires your OAuth app's credentials; the exact Google Cloud labels are Google's own.
  • curl or any HTTP client, and a shell where you can set two environment variables.

Enable Google sign-in, step by step

Step 1: Pick the credential the call will carry

A full-access API key of the application, including its primary secret, already covers Authentication. If you want a narrower key, open Developers then API keys in the Business Console, create a key for the application you are setting up, and give it the authentication resource at write (which also reads) or at read for read-back only. A key belongs to one application and works only for it. Expiry, IP allowlists and rotation are covered in API keys.

Step 2: Build the management base URL

Every call on this page goes to your application's Authentication management API.

export MANAGEMENT_BASE="https://apx.didit.me/auth/v2/organizations/$ORG_ID/applications/$APPLICATION_ID/authentication/"
export DIDIT_API_KEY="..."

The same routes are described by openapi-auth.json under the Setup tag, which the server SDKs generate as the authentication_setup resource.

Step 3: Prove it in the sandbox with Didit's test app

A sandbox application can use Didit's own social apps instead of yours, which is enough to finish a setup and prove the flow. This route is for validation only. Live sign-ins require your own OAuth app's credentials, because test apps never serve live applications.

curl --fail-with-body --request PUT "${MANAGEMENT_BASE}methods/google/" \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "credential_source": "didit_test"}'

didit_test covers Google, Microsoft, Apple and GitHub, on sandbox applications only. If it answers configured: true, open your hosted sign-in page and confirm the Google button is there.

Step 4: Create your Google OAuth client

In Google Cloud, create the Google OAuth client required for your integration and keep its client ID and client secret. You will add the redirect URI that Didit returns in step 6, so leave the Google screen open. Do this before any real sign-in, because the provider checks the redirect URI you registered on every request.

Step 5: Enable Google with your own credentials

curl --fail-with-body --request PUT "${MANAGEMENT_BASE}methods/google/" \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "credentials": {"client_id": "1234.apps.googleusercontent.com", "client_secret": "GOCSPX-..."}}'

The response returns the method as it now stands, including the callback_uri you have to register at Google. Nothing in that response echoes the secret back.

Step 6: Register the returned callback_uri at Google

Copy the exact callback_uri from the response into the authorized redirect URIs of your Google OAuth client, character for character. Didit only returns a person to a redirect URL you registered, and Google only accepts the URI it was told about, so a trailing slash or a different subdomain is enough to break the flow.

Step 7: Read the setup back

curl --fail-with-body \
  -H "x-api-key: $DIDIT_API_KEY" \
  "$MANAGEMENT_BASE"

GET is the read-back: every method with enabled and credential_source, plus the callback URLs, session rules and sign-up policy. The client_id is the only part of the credentials you can read. The secret is write-only and no response returns it. On a live application, didit_test_credentials is false for all four social providers.

Step 8: Sign a person in

The hosted page runs every method you enabled, so Google now appears next to them. Register your redirect URL and allowed origin under Authentication then Security and sessions first, then open the sign-in page or click through from an SDK such as @didit-protocol/auth. The browser returns to your redirect_uri with code and state, your app exchanges the code at POST /token/, and your backend verifies the access token against the issuer's published keys. The quickstart walks the whole flow in about 10 minutes.

An email code entry screen from a Didit sign-in flow
A code step from the same hosted flow. Methods you never enable do not appear on that page at all.

Expected output

Documented answers to PUT methods/google/ and what each one means
What you sentWhat comes backWhat it means
enabled: true with credentialsThe method as it now stands, including callback_uriRegister that URI at Google. The secret is not in the response.
credential_source: "didit_test" and the test app serves Google200 with configured: trueThe test app serves the method and hosted sign-in offers it.
credential_source: "didit_test" on a live application{"credential_source": "sandbox_only"}Test apps never serve live sign-ins. Use your own OAuth app.
credential_source: "didit_test" where no test app exists for Google{"credential_source": "unavailable"}The method stays off. Use your own OAuth app.
enabled: true with no credentials, none stored before{"credentials": "required"}Send client_id and client_secret in the same call.
A method that is always on{"enabled": "always_on"}It cannot be turned off. Google is not one of these.

Inputs and outputs

Fields on the Google sign-in call
FieldDirectionNotes
credentials.client_idRequest, readable backYour Google OAuth client ID. The only credential part you can read.
credentials.client_secretRequest onlyWrite-only. No response returns it. Store it at Google, not in your repo.
enabledRequesttrue turns the method on. Required.
credential_sourceRequest and read-back"didit_test" uses Didit's test app; read back the method configuration to confirm its current credential source.
callback_uriResponseThe exact redirect URI to register at Google.
configuredResponsetrue when the test app serves the method.
didit_test_credentialsRead-backNames the providers a test app can serve for this application. false for all four on a live application.
x-api-keyRequest headerThe application API key, full access or scoped with authentication.

Failure cases and recovery

What breaks, why, and the fix
SymptomCauseFix
401The request carried no credential at allSend x-api-key, a didit:management grant, or a console session.
403 on every setup routeA token from POST /programmatic/login, which is minted for the application rather than the consoleUse an API key of the application or an owner-approved grant.
403A scoped key without the authentication scopeAdd authentication at write, or at read for GET only.
403A key of another application, a grant limited to didit:verification, or a grant approved for another organizationUse the credential that belongs to this application and organization.
{"credentials": "required"}The method was switched on with no stored credentialsRepeat the call with both client_id and client_secret.
{"credential_source": "sandbox_only"}The application is liveRegister your own Google OAuth app and send its credentials.
{"credential_source": "unavailable"}The deployment has no test app for GoogleSame fix: your own OAuth app.
Google rejects the redirectThe URI registered at Google differs from the returned callback_uriCopy the returned value character for character.
No Google button on the hosted pageThe method was never enabled, or Authentication is off for a live applicationRead the setup back with GET, and turn Authentication on from Products.

What is billed, and where review stops

Nothing in this setup is a paid step. PUT and GET on the management API are configuration calls, not checks. The published price feed charges completed checks, and these requests configure Authentication. Authentication is free for the first 50,000 active users each month; past that, the price book lists $0.02 per active user month. A Sandbox application is never billed, and sandbox testing is free and unlimited.

The review boundary is narrow. Inside Didit the human decision is access: who may call the management API, which is set by the API key scope, the grant scopes and the person's role in the console. Your provider controls its own app review for the OAuth client. If your sign-up policy asks for an identity verification, that is a separate product, priced and billed separately from the sign-in.

Worked cost example

Take a live application on the Free plan with 62,500 people signing in with Google in one month, and 1,000 of those people also pass a full ID check at sign-up. The Free plan costs $0 per month and gives eligible organizations $10 of monthly credit, applied before top-ups or other charges. Usage is paid from that credit first.

  • Active users: 62,500. Free allowance: first 50,000. Billable active users: 62,500 - 50,000 = 12,500.
  • Active-user usage: 12,500 x $0.02 = $250.00.
  • Full ID checks: 1,000 x $0.33 = $330.00.
  • Usage before plan credit: $250.00 + $330.00 = $580.00.
  • Free plan monthly credit: -$10.00.
  • Usage charges after credit: $580.00 - $10.00 = $570.00.
  • Free plan subscription fee: $0.00.
  • Month total: $0.00 subscription + $570.00 usage = $570.00.

On Scale, the monthly subscription fee is $299.00 and the plan gives $350.00 of monthly credit, with 10% off Didit prices. The same traffic:

  • Active-user usage: 12,500 x $0.018 = $225.00.
  • Full ID checks: 1,000 x $0.297 = $297.00.
  • Usage before plan credit: $225.00 + $297.00 = $522.00.
  • Scale monthly credit: -$350.00.
  • Usage charges after credit: $522.00 - $350.00 = $172.00.
  • Scale subscription fee: $299.00.
  • Month total: $299.00 subscription + $172.00 usage = $471.00.

If usage on Scale had stayed at or below $350.00, the monthly credit would cover it and the month would cost the $299.00 subscription fee alone. In sandbox, the same traffic costs $0.00.

How Didit billing works: credits, auto-recharge and volume discounts
Authentication usage is billed from prepaid credit like every other Didit product, with the first 50,000 monthly active users free.

Sources

Next step: open business.didit.me, switch to your Sandbox application, run the didit_test call, and confirm the Google button appears on your hosted sign-in page. No sales call, and the sandbox is never billed.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

How do I enable Google sign-in for Didit Authentication with the API?

Send PUT to {MANAGEMENT_BASE}methods/google/ with a body of {"enabled": true, "credentials": {"client_id": "...", "client_secret": "..."}}, authenticated with an application API key in the x-api-key header, an owner-approved grant with didit:management, or a console session. The response returns the method as it now stands, including the callback_uri you must register at Google. On a sandbox application you can skip the credentials and send {"enabled": true, "credential_source": "didit_test"} instead.

What exactly do I send in the PUT methods/google/ request?

Three things: the header x-api-key with your application key, the header Content-Type: application/json, and a JSON body with enabled set to true plus either a credentials object holding client_id and client_secret, or credential_source set to didit_test on a sandbox application. Nothing else is required for Google.

Where do I find the callback_uri I have to register at Google?

It comes back in the response to the PUT that enables the method with your credentials. Register that exact string as an authorized redirect URI on your Google OAuth client, character for character, because Didit only returns people to redirect URLs you registered and Google only accepts the URI it knows about. The GET read-back also lists the callback URLs for the application.

Can I read the Google client_secret back after saving it?

No. The secret is write-only: no response returns it, and client_id is the only part of the credentials you can read back from the application. Keep the secret where you created it, in your Google project, and send it again if you ever need to replace it with a new one.

What does {"credentials": "required"} mean and how do I fix it?

It means you asked to switch the method on and no credentials were stored for it before, so there is nothing to run Google sign-in with. Repeat the same call with a credentials object containing client_id and client_secret. On a sandbox application you can send credential_source: "didit_test" instead.

Can I test Google sign-in in a sandbox without my own OAuth app?

Yes. A sandbox application can use Didit's own social apps for Google, Microsoft, Apple and GitHub by sending credential_source: "didit_test". When the test app serves Google, the call answers 200 with configured: true and hosted sign-in offers the method. Test apps never work on live applications, so this is a sandbox route only.

Why did credential_source come back as sandbox_only?

Because the application you called is a live application, and Didit's test apps never serve live sign-ins. That is the guard rail, not an error in your request. Register your own Google OAuth client and enable the method with its client_id and client_secret.

Why did credential_source come back as unavailable?

The deployment has no test app for that provider, so the method stays off. The fix is the same as for a live application: create your own Google OAuth client and enable the method with its credentials. You can check which providers a test app can serve for a given application by reading didit_test_credentials on the configuration.

Which credential can call the Authentication management API, and which ones get a 403?

An API key of the application (full access, or scoped with the authentication resource), an owner-approved grant with didit:management, and a console session all work. A token from POST /programmatic/login, a scoped key without the authentication scope, a key of another application, a grant limited to didit:verification and a grant approved for another organization are refused with 403. A request with no credential at all answers 401.

Does Google sign-in cost anything?

The setup calls are configuration writes and cost nothing. Sign-in is free for the first 50,000 active users each month, and past that the price book lists $0.02 per active user month; on Scale the same unit is $0.018. Sandbox testing is free and unlimited, and a Sandbox application is never billed.

Does enabling Google sign-in also verify the person's identity?

No. Didit Authentication signs your own users into your application, and it is separate from identity verification. Signing in does not approve a verification or authorize a payment, and your backend makes those decisions from each product's own result. If your settings ask for a verification at sign-up, that is a separate paid check.

Can I switch Google sign-in on from the console instead of the API?

Yes. Authentication then Sign-in methods in the Business Console lists Google, Microsoft, Apple and GitHub, each with either Didit's test credentials in Sandbox or your own client ID and secret. The API route on this page is for teams that configure from code, and both routes write to the same application settings, so a change made in one shows up in the other.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.