
Login via Gosuslugi, VK ID, Yandex ID, and Sber ID: who is available, app registration and OAuth
🌐 Machine-translated from Russian. Show original
Logging in through an external account removes your password storage and speeds up registration. Four providers are popular in Russia: Gosuslugi (ESIA), VK ID, Yandex ID , and Sber ID. They differ greatly in login threshold: Yandex ID can be activated in the evening, ESIA is a weekly project with electronic signatures and applications.
⚖️ Rules are changing. The post is an overview of official sources as of November 2026, not a legal or tax consultation. Before making a decision, check the current versions: pravo.gov.ru, consultant.ru, nalog.gov.ru, digital.gov.ru.
In this part:
Provider comparison#
| Yandex ID | VK ID | Sber ID | Gosuslugi (ESIA) | |
|---|---|---|---|---|
| Protocol | OAuth 2.0, PKCE | OAuth 2.1, PKCE | based on OpenID Connect | OAuth 2.0 / OpenID Connect signed GOST |
| Where to register | oauth.yandex.ru | VK ID account for business | Sber ID portal | Gosuslugi + ESIA technology portal |
| Who connects | app owner | app owner | organization, offer via EDM, | organization with a legal entity account in ESIA |
| Signature and certificates | not required | issuance of the certificate | QES of the information system | |
| SDK | Sage for the web, LoginSDK | Web, Android, iOS, Flutter | JS, Android, iOS, | there is no official SDK, there are open libraries |
| Difficulty | low | low | medium | high |
Exact terms, limitations, and costs are in each provider's documentation. Check them before starting development.
General scheme: Authorization Code + PKCE#
All four providers use an Authorization Code scheme: the user goes to the provider's page, agrees, returns to you with a one-time code, and your server exchanges the code for tokens.
- The backend generates
state(CSRF protection) andcode_verifier, according tocode_challenge = BASE64URL(SHA256(code_verifier)). - The browser redirects to the provider's
authorizefromclient_id,redirect_uri,scope,state,code_challenge. - The provider returns
redirect_uricodeandstateparameters. - The backend verifies
state, sendscode, andcode_verifierto the token endpoint. - Via the access token, the backend obtains a profile, finds or creates a user, and issues its session.
// Node.js 20+: генерация PKCE и state
import crypto from "node:crypto";
const b64url = (buf) => buf.toString("base64url");
export function pkce() {
const verifier = b64url(crypto.randomBytes(32));
const challenge = b64url(crypto.createHash("sha256").update(verifier).digest());
const state = b64url(crypto.randomBytes(16));
return { verifier, challenge, state }; // verifier и state — в серверную сессию
}
Security rule: client_secret and tokens — only on the server. In the mobile app — only PKCE without secrets.
Yandex ID#
Documentation — yandex.ru/dev/id. You can request login, first and last name, gender, portrait, email, phone number, and date of birth — within the rights selected during registration.
App registration:
- Open oauth.yandex.ru and create the app.
- Select the type "To authorize users." The type cannot be changed after registration; "API access" applications do not receive group rights
login. - Specify the platforms and Redirect URI — it must match the
redirect_uriin the query. - Select permissions, such as
login:infoandlogin:email. The authorization application can obtain up to three groups of permissions. - Keep ClientID and Client secret in server secrets.
Requests:
# 1. Перенаправление пользователя
https://oauth.yandex.ru/authorize?response_type=code&client_id=<CLIENT_ID>
&redirect_uri=https://example.ru/auth/yandex/callback
&state=<STATE>&code_challenge=<CHALLENGE>&code_challenge_method=S256
# 2. Обмен кода на токен (код живет 10 минут)
curl -s https://oauth.yandex.ru/token \
-d grant_type=authorization_code \
-d code="$CODE" \
-d code_verifier="$VERIFIER" \
-d client_id="$YA_CLIENT_ID" -d client_secret="$YA_CLIENT_SECRET"
# 3. Профиль пользователя
curl -s -H "Authorization: OAuth $ACCESS_TOKEN" "https://login.yandex.ru/info?format=json"
The response /info — id, login, client_id, psuid, and if you have rights — default_email and default_phone. Link your account to id, not to email: the address may change. Do not pass the token in the oauth_token query parameter — it will appear in the logs.
For the site, there is instant authorization (sajest), for mobile users — LoginSDK.
VK ID#
Documentation — id.vk.ru/about/business/go/docs. VK ID authorization works via OAuth 2.1 and requires PKCE. The old VKontakte OAuth is considered obsolete: the user's new access token is obtained through OAuth VK ID.
How to connect:
- Create an app in the VK ID business account (login via id.vk.ru).
- Specify the trusted redirect URL and platforms.
- Choose the method: ready-made buttons and One Tap via SDK or custom integration via API.
Web SDK (@vkid/sdk, source code — github.com/VKCOM/vkid-web-sdk):
import * as VKID from "@vkid/sdk";
VKID.Config.init({
app: 12345678, // ID приложения
redirectUrl: "https://example.ru/auth/vk/callback",
state: STATE_FROM_SERVER,
codeVerifier: VERIFIER_FROM_SERVER, // SDK сам посчитает code_challenge
scope: "email phone",
});
Code exchange for tokens — POST https://id.vk.ru/oauth2/auth with grant_type=authorization_code, code, code_verifier, device_id, client_id, redirect_uri. The values of code and device_id come in callback. Masked phone and email are available via ID token, full data via access token via the VK ID API METHOD DIRECTORY.
Login is connected through the same platform with Odnoklassniki and Mail accounts — they operate via OAuth 2.0.
Sber ID#
Documentation is developers.sber.ru/docs/ru/sberid. The threshold is higher than Yandex and VK: connection is through the organization.
- Register the organization on the Sber ID portal.
- Sign the offer via EDM.
- Obtain Client ID, Client Secret, and issue a certificate.
- Implement obtaining code, tokens (access token and ID token), and user data via userInfo; verify
nonceandstate. - Implement confirmation of successful login and place the Sber ID button according to the rules.
Scenarios: for the web — Web to Web, mWeb to App, Web to Web SSO; for mobile — App to Webview, App to App, App to App SSO, OIDC to App. There is a JS SDK and SDK for Android and iOS. Login to iFrame is not supported. The user is identified by sub from the ID token.
Gosuslugi (ESIA)#
The most complicated, but for some services, the most valuable option: verified identity. The procedure is described in the article "How to Connect to ESIA" on info.gosuslugi.ru.
What a legal entity needs:
- Verified manager account and manager's QES from the certification authority.
- The organization's account in ESIA is registered by the head, data is verified by the Federal Tax Service.
- The employee registering the system is joined to the organization and added to the "Technology Portal" access group.
- The information system is registered on the ESIA technological portal. Prerequisite from the instructions: the IS is registered in SMEV, the mnemonic in ESIA coincides with SMEV. Mnemonics are used as
client_id. - IS electronic signature certificate — used to sign requests to ESIA.
Applications:
| Wednesday | What to serve | Where |
|---|---|---|
| Test | application in the form from the Regulations: regulatory legal acts (RLA) - basis, required scope, IP certificate, licenses and contracts if necessary, | sd@sc.digital.gov.ru |
| Productive | same plus test application number; certificate uploaded via the tech portal | sd@sc.digital.gov.ru |
Important: the application specifies the regulations on which the system is connected and the required access scopes. Without grounds, connection to the industrial environment may be denied — check in advance that your scenario is suitable.
Technology. ESIA supports Authorization Code Flow. The key difference from other providers is client_secret not a string, but an electronic signature of the IS according to GOST R 34.10-2012 over the query parameters (client_id, scope, timestamp, state, etc. — the exact composition and format depend on the endpoint version). For signing on the server, a cryptographic provider with GOST support is required. The exact format and addresses are taken from the current methodological recommendations and the digital.gov.ru Regulations. The test environment is esia-portal1.test.gosuslugi.ru.
How to store a pair of accounts#
CREATE TABLE user_identity (
user_id bigint NOT NULL REFERENCES users(id),
provider text NOT NULL, -- 'yandex' | 'vkid' | 'sberid' | 'esia'
subject text NOT NULL, -- id / sub / oid от провайдера
linked_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (provider, subject)
);
- The key is a pair of
(provider, subject), not email. - Save only the required profile fields: these are your personal data with all the requirements from Federal Law 152-FZ for developers in 2026: localization, RKN notification, consent, leaks, and penalties.
- No verification
state— CSRF login opened. - Client secret in the mobile app or frontend.
- The user is linked by email, and changing the address creates a duplicate account.
- Requested "everything indiscriminately" — users get scared by the consent screen, and you get extra PD.
- For ESIA, they start writing code before the organization is registered and the QES is issued—and it comes down to weeks of waiting.
Checklist#
- Providers selected according to the audience and requirements (verified identity — ESIA only).
- Applications are registered, Redirect URIs match across all environments.
- PKCE and
stateare implemented and verified. - The secrets lie in the server environment variables.
- Linking accounts by
(provider, subject). - Minimum rights are requested, and these data are accounted for in the PD policy.
- For ESIA: QES, organization account, tech portal, applications, GOST crypto provider.
Next — Online payment in Russia: Yukassa, CloudPayments, T-Cashier, Robokassa, SBP and receipts under 54-FZ, client registration, code retrieval, user information
Comments · 0
No comments yet.Sign in to comment, rate and see all comments.