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.

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.
| Item | Detail |
|---|---|
| What you end up with | One person record per human, with the Google identity stored on it as a social link where provider is google |
| Product | Didit Authentication, turned on per application |
| Price | First 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 control | signup_policy, one of anyone, invited or allowed_domains. It gates new account creation and does not match accounts |
| Link key | The imported Google social subject, carried in the import's social array on the person |
| Install routes | Hosted sign-in page, your own screens through the SDKs, the management API, or the MCP connector |
| Prerequisites | Google OAuth web client or Didit's test app in a sandbox, an API key with the authentication scope, a registered redirect URL |
| First sign-in | The 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.
What the finished link looks like
- 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.
invitedmeans 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_verifiedas its own field withkeep_verifiedfor file jobs. - An alarm. A stored Google link turns a returning sign-in into
auth.login. Anauth.signupfor 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.
| Route | What you build | Use 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 API | PUT 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 connector | An 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
| Prerequisite | Requirement | Where it is set |
|---|---|---|
| Plan | Any 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 client | Your 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 URI | The callback_uri the PUT returns, registered at your provider. | Response of methods/google/, then your Google project |
| Permissions | The 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 URLs | Every callback your app returns to, matching the registered entry exactly. | Application settings |
| Sign-up policy | One 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
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.
Enable the Google method. Call the application's Authentication management API with a key that has the
authenticationscope. The base ishttps://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_urithe response returns at your provider. The secret is write-only: no response returns it, andclient_idis the only part you can read back.
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. Set the sign-up policy that stops the duplicate.
signup_policyhas three values.anyonelets any sign-in create a person,invitedrequires an invitation link, andallowed_domainslimits sign-ups to your company domains. For a base of existing users,invitedis 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.GETon 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 inopenapi-auth.jsonunder the Setup tag.
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.Attach the Google subject to the people you already have. Send the batch import with
dry_run: truefirst, then repeat it withdry_run: false. The migration docs describe importing social links as the route for people who already linked a social account elsewhere;keep_socialkeeps 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 withkeep_socialand keepsemail_verifiedwithkeep_verified, and each keep switch is true unless you send false.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 yourredirect_uriwithcodeandstate. 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 producesauth.signup, a returning person producesauth.login, and a new device producesauth.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: anauth.loginfor the imported person, not a freshauth.signup.Verify the token and the live session on your backend. Check the ES256 signature against your issuer's JWKS, then
iss,aud,expandtyp: at+jwt, and reject a token whoseactis not null unless the route accepts AI agents. Before a sensitive action, check the live session withGET /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
| Field or event | Rule from the docs | What you send or watch for a Google link |
|---|---|---|
email | Required | The address already on the existing person record |
email_verified | true or false, also 1/0 and yes/no | Set true only when that address was verified on your side |
external_id | Up to 255 characters, becomes the person's vendor_data | Your own user ID, so events land on the right person |
display_name | Up to 200 characters | The name on the existing record |
social | Up to 8 {provider, subject, tenant_id} entries. tenant_id is required for Microsoft only | provider is google, subject is the Google subject you import for that account |
signup_policy | Application setting, one of anyone, invited or allowed_domains | Controls new account creation. It does not match an existing person or attach a social link. |
keep_social | File job switch, keeps social sign-in links, true unless you send false | Send true when you move existing linked users in |
keep_verified | File job switch, keeps email_verified | Send true only when the source of the addresses is known |
auth.signup | Webhook for a sign-up | A new person. Treat it as an alarm if you already hold that address |
auth.login | Webhook for a sign-in | The link resolved to the existing person |
auth.new_device | Webhook for a new device | Optional, 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
PUTanswers 200 withconfigured: true, so the test app serves the method. GETon the management base listsgooglewithenabledand itscredential_source, anddidit_test_credentialsnames the providers a test app can serve.- The hosted page at
/sign-inoffers the Google button, because hosted sign-in shows only the methods you enabled. - The browser returns to your redirect URL with
codeandstate, and the state matches what you sent. - The token exchange returns
access_token,id_token,refresh_token,token_typeandsession_id. - The person's timeline shows a login for the imported person, not a fresh sign-up.
| Answer | Meaning | Fix |
|---|---|---|
{"credentials": "required"} | The method was switched on without credentials and none were stored before | Send 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-ins | Create 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 off | Use your own credentials for that provider |
{"enabled": "always_on"} | The method cannot be turned off | Nothing 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 off | Exchange within 60 seconds, match the redirect URI exactly, keep the method on |
400 {"error": "invalid_client"} | client_id is not your application ID | Send your application ID |
400 {"error": "mfa_required"} | The sign-in did not meet your MFA policy | Finish the MFA step, TOTP, recovery code or passkey |
| Import dry run failed | The dry run lists its errors and writes nothing | Fix the file and upload it again |
import_running | One import runs per application at a time | Wait for the current import, which resumes after its last committed batch |
400 {"idempotency_key": "different_payload"} | The same key was reused with different content | Send 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
socialentry 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
- Didit docs: Authentication, end-user sign-in, passkeys and sessions
- Didit docs: Sign-in methods, passkeys, codes, social, SSO
- Didit docs: Set up Didit Authentication by API
- Didit docs: Migrate users, import passwords and MFA
- Didit docs: Authentication integration guide, architecture and go-live
- Didit docs: Tokens and JWKS, verify Didit Authentication JWTs
- Didit docs: Authentication events and webhooks
- Didit docs: MCP authentication
- Didit documentation index
- Didit pricing and pricing.json, read November 26, 2026
- Didit MCP server setup
- Didit MCP server endpoint
- Didit Business Console
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.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alberto Rosas
Co-founder and CEO

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.
Your obligations · 3 regions
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.
- 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.
Didit Academy