Yandex Games SDK for Unity
  • Welcome
  • Getting Started
    • SDK Installation & Setup
      • Installation
      • Setting Up the SDK
      • Setting Up Local Development Server
    • Gameplay Lifecycle & Environment
      • Gameplay Lifecycle Events
      • Get Server Time
      • Get Environment
    • Core Features
      • Authentication
      • Cloud Storage
      • Leaderboards
      • Advertisements
  • Extended Functionality
    • YGNetwork
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. Core Features

Authentication

Securely manage user authentication with Yandex accounts, allowing players to log in and save their progress.

The Authentication feature in the Yandex Games SDK for Unity allows players to log in using their Yandex accounts, enabling access to personalized features such as saving progress and accessing leaderboards.

Overview

With authentication:

  • Players can securely log in using their Yandex accounts.

  • You can retrieve and display player profile information (e.g., name and profile picture).

  • You can enable continuity across devices by linking game data to user accounts.

Basic Authentication Example

Here’s a simplified example for authenticating a user in Unity. This mirrors the JavaScript version of Yandex’s authentication flow but is adapted for Unity:

YandexGamesSDK.Instance.Authentication.AuthenticateUser(requireSignin: true, (success, message) =>
{
    if (!success)
    {
        Debug.LogError($"Authentication failed: {message}");
    }
    else
    {
        var userProfile = YandexGamesSDK.Instance.Authentication.GetUserProfile();
        Debug.Log($"Authenticated user: {userProfile.name}");
    }
});
  • requireSignin: true: Prompts the user to sign in if not already authenticated.

  • Callback: If success is true, the user's profile information (like their name) is accessible via GetUserProfile().

PreviousCore FeaturesNextCloud Storage

Last updated 7 months ago

Was this helpful?

For further details on the JavaScript version of this method, refer to the .

Yandex Games SDK JavaScript documentation