This project is not covered by Drupal’s security advisory policy.

Russian ID login adds "Sign in with Yandex ID" and "Sign in with VK ID" buttons to Drupal's sign-in and registration forms. Since December 2023, Russian Federal Law 406-FZ lets websites in Russia authorize users only by a Russian phone number, Gosuslugi, the Unified Biometric System, or an information system owned by a Russian citizen or company, such as Yandex ID or VK ID. This module covers the last option without third-party SDKs: it depends on Drupal core only.

Features

  • Yandex ID and VK ID (the current VK ID: OAuth 2.1 with PKCE, not the legacy VK OAuth) out of the box.
  • Providers are attribute-based plugins: Sber ID, T-ID, Mail.ru ID or any OAuth 2.0 or OpenID Connect provider is a small class. The README has a complete example.
  • Credentials live in settings.php, never in configuration. A provider without credentials shows no button and its paths answer 404.
  • Safe account matching: an existing account is linked by email only when the provider vouches for the address and the account's own address was proven. Otherwise people sign in another way once and confirm the link.
  • Sign-up with a consent checkbox, following core's "Who can register accounts" setting, including administrator approval.
  • A "Sign-in methods" tab on the user profile to link and unlink providers. The last way to sign in cannot be removed.
  • A status page with the redirect URI of each provider; secrets are never shown.
  • A block with the buttons for any region, and CSS custom properties for theming.
  • Works on sites installed in a subdirectory.
  • Russian translation included.

Security

  • PKCE (S256) and a single-use state bound to the session and the provider.
  • Linking from the profile is protected by a CSRF token and bound to the signed-in user.
  • Yandex ID tokens are checked against the site's client ID.
  • Cross-site POST requests to the sign-up and sign-in methods forms are refused.
  • The callback answers with a redirect only, so the authorization code cannot leak through the Referer header.
  • Provider tokens are used once to learn who signed in and are not stored.

Post-installation

Open Configuration, People, Russian ID login. The page lists the providers and the redirect URI of each. Register an application with Yandex ID or VK ID using that redirect URI, put the client ID (and, for Yandex ID, the client secret) into settings.php as the README shows, and rebuild caches. The buttons then appear under the sign-in and registration forms. The same page holds the consent checkbox of new accounts.

Additional requirements

Drupal 10.3 or later, or Drupal 11. Only the core User module is required. The PHP intl extension is recommended for addresses with international domain names. An application registered with each provider you enable.

Recommended modules/libraries

  • Email code login: passwordless sign-in by a code sent by email. When it is installed, Russian ID login uses its consent settings, account creation and verified email flag, and adds the buttons to its forms and dialog.

Similar projects

  • Social Auth Yandex builds on Social Auth; its stable release supports Drupal 9 and 10.
  • Social Auth Vkontakte builds on Social Auth and the VK PHP SDK and uses the legacy VK OAuth rather than VK ID.
  • OpenID Connect is a generic client; Yandex ID and VK ID need their own handling of user info and device IDs.

Russian ID login focuses on Russian providers, has no dependencies beyond core, supports VK ID, and links accounts by email only when it is safe.

Supporting this module

Bug reports, provider plugins and translations are welcome in the issue queue.

Community documentation

The README covers configuration, how accounts are matched, security notes, adding a provider and the integration with Email code login.

На русском

Russian ID login добавляет кнопки «Войти через Яндекс ID» и «Войти через VK ID» к формам входа
и регистрации Drupal. С 1 декабря 2023 года по закону 406-ФЗ российские сайты могут пускать
пользователей только по российскому номеру телефона, через Госуслуги, Единую биометрическую
систему или через информационную систему российского владельца, например Яндекс ID или VK ID.
Модуль закрывает последний вариант и не требует ничего, кроме ядра Drupal.

  • Яндекс ID и VK ID «из коробки». Для VK используется актуальный VK ID (OAuth 2.1 с PKCE), а
    не устаревший OAuth ВКонтакте.
  • Провайдеры подключаются плагинами: Сбер ID, T-ID, Mail.ru ID или любой провайдер OAuth 2.0 /
    OpenID Connect — это небольшой класс, пример есть в README.
  • Ключи приложений хранятся только в settings.php, не в конфигурации. Пока ключей нет, кнопка
    не показывается.
  • Безопасная привязка: существующий аккаунт привязывается по почте только если провайдер
    подтверждает адрес и адрес аккаунта тоже подтверждён. В остальных случаях человек один раз входит
    другим способом и сам подтверждает привязку.
  • Регистрация с галочкой согласия на обработку персональных данных, по настройке ядра «Кто
    может регистрироваться».
  • Вкладка «Способы входа» в профиле: привязать и отвязать провайдеров. Последний способ входа
    удалить нельзя.
  • Работает на сайтах в подкаталоге. Русский перевод в комплекте.

Рекомендуется вместе с Email code
login
— вход по коду из письма. Тогда у сайта общие правила регистрации и согласия, а кнопки
Яндекса и VK появляются и в его форме, и во всплывающем окне входа.

Project information

Releases