Skip to main content

How to Link Google Sign-In to an Existing Account in 2026

Link Google sign-in to an existing person by storing the Google subject on that person, not by matching email strings. Gate sign-up so the button cannot create an account on its own, then confirm the link with the auth events.

How to Link Google Sign-In to an Existing Account in 2026

Contents

In this guide

Jump to the part you need.

This guide fits teams that already have users in Didit Authentication and want a Google button to reach those same people, not create duplicates. The result is one person record with the Google identity stored on it, plus a sign-up policy that blocks a duplicate at the source. Authentication is free for the first 50,000 active users each month, then $0.02 per active user per month. The caveat: link on the imported social subject, not the email.

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

Linking Google sign-in to an existing Didit Authentication user at a glance
ItemDetail
What you end up withOne person record per human, with the Google identity stored on it as a social link where provider is google
ProductDidit Authentication, turned on per application
PriceFirst 50,000 active users each month free, then $0.02 per active user per month. The Free plan adds $10 of monthly credit for organizations that sign up with a work email; phone codes are excluded. The sandbox is free and unlimited on every plan
Anti-duplicate controlsignup_policy, one of anyone, invited or allowed_domains. It gates new account creation and does not match accounts
Link keyThe imported Google social subject, carried in the import's social array on the person
Install routesHosted sign-in page, your own screens through the SDKs, the management API, or the MCP connector
PrerequisitesGoogle OAuth web client or Didit's test app in a sandbox, an API key with the authentication scope, a registered redirect URL
First sign-inThe docs' quickstart puts a first sign-in at about 10 minutes

Start free in the sandbox at business.didit.me, no sales call. For developers, connect Didit to an AI assistant through Didit MCP setup; the hosted server is mcp.didit.me/mcp. Product prices are on didit.me/pricing, and the sign-in product is documented in the Authentication overview.

Why a Google button creates a duplicate in the first place

Every duplicate starts with the same decision: your app treats a Google sign-in as a registration. A person who joined with an email code or a password clicks the Google button, the callback carries an identity your database has never seen, and a second record appears. The password record and the Google record then drift apart, and support has to reconcile two histories for one human.

Didit Authentication splits the problem in two. The first half is identity. A person is one record, and social links live on that record, so a Google identity can be attached to someone who already exists. The import format carries up to 8 link entries per person, each a {provider, subject, tenant_id} triple where provider is google, apple, github or microsoft. The second half is policy. signup_policy decides who may sign up at all: anyone, invited or allowed_domains. It controls new account creation; it does not match an existing person or attach a social link by itself. Get both right, the sign-up policy you selected and a correctly imported social subject, and the Google button cannot create a duplicate under that policy.

  • One person per human. The Google identity hangs off the existing record as a social link, so a later Google sign-in resolves to that person.
  • A policy you chose on purpose. invited means only an invitation link creates a person, which is the setting for a base of existing users.
  • An email you can trust. Only people with a verified email can sign in with a password, and the import carries email_verified as its own field with keep_verified for file jobs.
  • An alarm. A stored Google link turns a returning sign-in into auth.login. An auth.signup for an address you already hold is the signal that the link did not resolve.
  • Decisions made on your server. Your backend verifies the access token and checks the live session. The Google button never decides what a person may do.

Install routes: hosted page, your own screens, API and MCP

The setting that picks the first two routes is sign_in_ui, hosted by default or own, and you can change it later.

Four documented ways to run Google sign-in against an existing Didit Authentication user base
RouteWhat you buildUse it when
Hosted sign-in page (sign_in_ui: hosted)A sign-in button and a callback page. Didit runs every method, including magic links, company SSO and passkeys, plus MFA, protection challenges and verification at sign-up.You want the shortest build and every method.
Your own screens (sign_in_ui: own)Every screen and intermediate step through the SDKs' headless methods. Magic links run on the hosted pages only.You already own the sign-in UI.
Management APIPUT methods/google/ from your own code with an API key that has the authentication scope, or an owner-approved grant with didit:management.You configure applications from CI or your own admin panel.
MCP connectorAn AI assistant connected to the Didit MCP server acts with the grant its owner approved with didit:management, on the same setup routes.You want an assistant to read or change the setup for you.

The Didit MCP server is hosted at mcp.didit.me/mcp with OAuth sign-in, and the server is free on every plan. Client setup is on didit.me/developers/mcp/, and the grant detail is in MCP authentication. Agents that hold a didit:management grant can read the setup and enable or change the Google method for the applications their owner approved.

Prerequisites

What you need before the first linked Google sign-in
PrerequisiteRequirementWhere it is set
PlanAny plan. Every sandbox application has Authentication on from the start; a live application turns it on from the Products page. Until it is on, every runtime route for that application returns 404.Business Console
Google clientYour own OAuth app's client_id and client_secret. A sandbox application may use Didit's test app instead.Your Google project, then methods/google/
Callback URIThe callback_uri the PUT returns, registered at your provider.Response of methods/google/, then your Google project
PermissionsThe application's API key with the authentication resource at read or write, a console session, or an owner-approved grant with didit:management.Developers, API keys
Redirect URLsEvery callback your app returns to, matching the registered entry exactly.Application settings
Sign-up policyOne of anyone, invited or allowed_domains. Pick it before the button is live.Application settings, readable with GET on the management base

The six steps

  1. Turn Authentication on and register the redirect URL. Open the Business Console, select the application and turn Authentication on from the Products page. Sandbox applications have it on from the start. Register the redirect URL your app returns to, and remember the rule: the callback must exactly match one of your registered redirect URLs.

  2. Enable the Google method. Call the application's Authentication management API with a key that has the authentication scope. The base is https://apx.didit.me/auth/v2/organizations/{org_id}/applications/{application_id}/authentication/.

    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-..."}}'

    Register the callback_uri the response returns at your provider. The secret is write-only: no response returns it, and client_id is the only part you can read back.

    Didit's hosted sign-in page in a customer's brand, in light and dark mode, with a passkey button, email and password fields, and links to sign in with an emailed link, a phone number or single sign-on
    The hosted sign-in page in your brand, following the person's device in light or dark mode. Once Google is enabled, its button appears on this page for the people you imported.
  3. Set the sign-up policy that stops the duplicate. signup_policy has three values. anyone lets any sign-in create a person, invited requires an invitation link, and allowed_domains limits sign-ups to your company domains. For a base of existing users, invited is the setting that keeps the Google button from creating a person on its own. The policy controls new account creation; it does not match an existing person or attach a social link. GET on the management base reads the policy back, together with the callback URLs, session rules and each method's state. If you set it from code, the route is described in openapi-auth.json under the Setup tag.

    The hosted sign-up page with Google, Microsoft, Apple and GitHub buttons, an email field, a password field with its rules and a Create account button
    The hosted sign-up page, where the policy you picked decides who can be created. Under invited, an invitation link creates the person and the Google button alone does not.
  4. Attach the Google subject to the people you already have. Send the batch import with dry_run: true first, then repeat it with dry_run: false. The migration docs describe importing social links as the route for people who already linked a social account elsewhere; keep_social keeps those links in a file job. Use the Google subject from a source you trust, not an email string.

    {
      "rows": [
        {
          "email": "user@example.com",
          "external_id": "user-1234",
          "email_verified": true,
          "display_name": "Example User",
          "social": [{ "provider": "google", "subject": "1234567890" }]
        }
      ],
      "dry_run": true,
      "idempotency_key": "google-link-0001"
    }

    A dry run returns 200 with the result and writes nothing. With dry_run: false, a successful import returns 201, and a batch with any error returns 400 and imports nobody. If you are moving off another identity platform, the file job keeps social links with keep_social and keeps email_verified with keep_verified, and each keep switch is true unless you send false.

  5. Sign a person in with Google and confirm the resolution. Open the hosted page at /sign-in, click the Google button and finish the flow. The browser returns to your redirect_uri with code and state. Check the state, then exchange the code within 60 seconds.

    curl --fail-with-body "${DIDIT_AUTH_ISSUER}/token/" -H 'Content-Type: application/json' -d '{"grant_type": "authorization_code", "code": "CODE_FROM_CALLBACK", "code_verifier": "YOUR_PKCE_VERIFIER", "redirect_uri": "https://app.example.com/auth/callback"}'

    Then read the events. Each event lands on the person with the same vendor_data, next to their verifications and transactions. A person created by the sign-in produces auth.signup, a returning person produces auth.login, and a new device produces auth.new_device. The documented import is what carries the social link onto that person, so the sandbox test has to verify the resulting login event: an auth.login for the imported person, not a fresh auth.signup.

  6. Verify the token and the live session on your backend. Check the ES256 signature against your issuer's JWKS, then iss, aud, exp and typ: at+jwt, and reject a token whose act is not null unless the route accepts AI agents. Before a sensitive action, check the live session with GET /session/, which fails at once when the session was revoked, went idle or expired. An access token stays valid until it expires, within 5 minutes.

Field and event mapping

Import fields and auth events that prove the Google link resolved to the right person
Field or eventRule from the docsWhat you send or watch for a Google link
emailRequiredThe address already on the existing person record
email_verifiedtrue or false, also 1/0 and yes/noSet true only when that address was verified on your side
external_idUp to 255 characters, becomes the person's vendor_dataYour own user ID, so events land on the right person
display_nameUp to 200 charactersThe name on the existing record
socialUp to 8 {provider, subject, tenant_id} entries. tenant_id is required for Microsoft onlyprovider is google, subject is the Google subject you import for that account
signup_policyApplication setting, one of anyone, invited or allowed_domainsControls new account creation. It does not match an existing person or attach a social link.
keep_socialFile job switch, keeps social sign-in links, true unless you send falseSend true when you move existing linked users in
keep_verifiedFile job switch, keeps email_verifiedSend true only when the source of the addresses is known
auth.signupWebhook for a sign-upA new person. Treat it as an alarm if you already hold that address
auth.loginWebhook for a sign-inThe link resolved to the existing person
auth.new_deviceWebhook for a new deviceOptional, useful when a link is being probed from somewhere new

Test it in the sandbox

Run the whole flow in a sandbox application before you touch the live one. Sandbox testing is free and unlimited, every sandbox application has Authentication on from the start, and a sandbox application can use Didit's own social apps instead of yours. That is enough to finish a setup and prove it works.

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"}'

Expected success, in this order:

  • The PUT answers 200 with configured: true, so the test app serves the method.
  • GET on the management base lists google with enabled and its credential_source, and didit_test_credentials names the providers a test app can serve.
  • The hosted page at /sign-in offers the Google button, because hosted sign-in shows only the methods you enabled.
  • The browser returns to your redirect URL with code and state, and the state matches what you sent.
  • The token exchange returns access_token, id_token, refresh_token, token_type and session_id.
  • The person's timeline shows a login for the imported person, not a fresh sign-up.
What you may see instead, what it means and the fix
AnswerMeaningFix
{"credentials": "required"}The method was switched on without credentials and none were stored beforeSend client_id and client_secret, or use credential_source: "didit_test" on a sandbox application
{"credential_source": "sandbox_only"}The application is live and test apps never serve live sign-insCreate your own Google OAuth client for the live application
{"credential_source": "unavailable"}The deployment has no test app for that provider, so the method stays offUse your own credentials for that provider
{"enabled": "always_on"}The method cannot be turned offNothing to change
400 {"error": "invalid_grant"}Code unknown, used or expired, verifier or redirect mismatch, the person is blocked, the email is no longer verified, or the method was switched offExchange within 60 seconds, match the redirect URI exactly, keep the method on
400 {"error": "invalid_client"}client_id is not your application IDSend your application ID
400 {"error": "mfa_required"}The sign-in did not meet your MFA policyFinish the MFA step, TOTP, recovery code or passkey
Import dry run failedThe dry run lists its errors and writes nothingFix the file and upload it again
import_runningOne import runs per application at a timeWait for the current import, which resumes after its last committed batch
400 {"idempotency_key": "different_payload"}The same key was reused with different contentSend a new key for a new batch

Disconnect

To stop Google sign-ins, send enabled: false to methods/google/ with the same credential you used to enable it. A method that is always on answers {"enabled": "always_on"} instead. To rotate the secret, send new credentials in the same call, since the stored secret is never returned.

  • Turning the method off is a change to the application's sign-in configuration. The documented flow does not delete a person when a method is switched off, so plan any record cleanup as its own step.
  • On the Google side, delete the OAuth client you registered, or replace it and register the new callback at your provider.
  • Keep the social entry on the person so the link remains on the record if you enable Google again.

What this costs on both ends

The Google end. You register an OAuth web client in your own Google project and keep the client_id and client_secret there. The secret is write-only: no Didit response returns it. In a sandbox application you can skip the Google project entirely with credential_source: "didit_test".

The Didit end. Authentication is billed by active users. The first 50,000 active users each month are free, and the price book lists active users after the free allowance at $0.02 per active user per month. If you also verify identity at sign-up, the full ID check is $0.33: ID document verification $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03.

A worked example. An application with 62,000 active users in a month and 20,000 newly verified sign-ups:

  • Active users beyond the free allowance: 62,000 minus 50,000 = 12,000. At $0.02 each that is 12,000 x $0.02 = $240.00.
  • Full ID checks: 20,000 x $0.33 = $6,600.00.
  • Monthly total at list price: $240.00 + $6,600.00 = $6,840.00.

This total uses list prices. On Growth or Scale, the plan discount applies to Didit unit prices and the monthly credit is applied before top-ups, so the amount charged changes with the plan you choose.

Sources

Next step: open business.didit.me, create a sandbox application, enable Google with Didit's test app and run one import with dry_run: true before you touch a live user. No sales call.

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 link Google Sign-In to an existing email account without creating a duplicate user?

Store the Google identity on the person record that already exists instead of letting the button create a new one. In Didit Authentication you import the person with a social entry of {"provider": "google", "subject": "..."} and set signup_policy to invited so a Google click cannot create a person on its own. The policy controls new account creation; the social entry is what creates the link, and a later Google sign-in then resolves to that person.

Does a Google sign-in create a second user if the email already exists?

Only when the Google identity is not stored on the existing person and the sign-up policy lets a sign-in create people. With signup_policy set to invited, a person is created only through an invitation link. The policy does not match accounts by email; it only gates creation, so the duplicate is a configuration outcome, not something Google decides.

Should I link on the email address or on the Google user ID?

Link on the imported Google social subject, kept in the social array next to the person. The docs treat email as a required attribute of the person, not as the link itself, and email_verified is a separate field. Use the address to find the person only when that address came from a verified, trusted source; otherwise import the social subject you trust.

What does the social field in the Didit import accept?

social takes up to 8 entries of {provider, subject, tenant_id}. provider is google, apple, github or microsoft, and tenant_id is required for Microsoft only. This is the field that carries a Google link into an imported person.

How do I stop the Google button from creating new accounts?

Set signup_policy to invited, so only a person with an invitation link can be created, or to allowed_domains to limit sign-ups to your company domains. The third value is anyone, which lets any sign-in create a person. The policy controls new account creation and does not match an existing person by itself; the policy is part of the application settings and reads back with GET on the management base.

How do I confirm that a Google sign-in attached to the right person?

Subscribe to the auth.* webhooks. A returning person produces auth.login, a newly created person produces auth.signup, and a new device produces auth.new_device. Treat an auth.signup for an address you already hold as a failed link and fix the stored social entry.

How much does Didit Authentication cost for linked sign-ins?

The first 50,000 active users each month are free, and each active user after that costs $0.02 per month at list price. Plans add monthly credit: Free gives $10 for organizations that sign up with a work email, Growth $115 and Scale $350. The sandbox is free and unlimited on every plan.

Can I test Google sign-in without creating a Google OAuth client?

Yes, in a sandbox application. Send {"enabled": true, "credential_source": "didit_test"} to methods/google/ and Didit's own test app serves Google, Microsoft, Apple and GitHub. Test apps never serve live sign-ins, so a live application answers {"credential_source": "sandbox_only"}.

Why did enabling Google return {"credentials": "required"}?

Switching the method on without credentials, when none were stored before, answers {"credentials": "required"}. Send your Google OAuth client's client_id and client_secret in the same call, or use credential_source: "didit_test" on a sandbox application.

Does linking Google replace identity verification?

No. Signing in is separate from verifying someone's identity in Didit, and a sign-in does not approve a verification or authorize a payment. Your backend makes those decisions from each product's own result. If you want a check at sign-up, the sign-in call returns verification_required with a verification_url that is valid for 30 minutes.

Can an AI assistant configure the Google method over MCP?

Yes. The Didit MCP server is hosted at mcp.didit.me/mcp with OAuth sign-in, and an agent uses the grant its owner approved with didit:management to reach the setup routes. The server SDKs generate the same routes as the authentication_setup resource.

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.