UWP SDK Login

Introduction

This article describes how to interface with the Miracle Games SDK login interface to open the login window.

Before calling the login interface, make sure you have completed the initialisation of the SDK [ Refer to ].

User login

Open the login screen

Recommended Practice:Call the login interface in the callback after successful initialisation.

C#CPP

public MainPage()
{
    this.InitializeComponent();
    Loaded += (sender, args) =>
    {
     
        
         var auth = await MiracleGames.AuthenticationManager.AuthenticateAsync();//login interface
         if (auth.ReturnValue)//login callback
         {
             //Log in success.
             //var uid =  MiracleGames.AuthenticationManager.UserInfo.Id;
             //var token =  MiracleGames.AuthenticationManager.UserInfo.Token;
         }
    };
}


Void MainPage::Login()
{
	auto concurrency = Concurrency::create_task(MiracleGames::AuthenticationManager::AuthenticateAsync());//login interface
	concurrency.then([](MiracleGames::Services::Core::Common::AsyncProcessResult^ result)
	{

		if (!result->ReturnValue)//login callback
			return;

		//Log in success.and get user uid and token
		auto uid = MiracleGames::AuthenticationManager::UserInfo->Id;
		auto token = MiracleGames::AuthenticationManager::UserInfo->Token;
		
	});

}

Implement in-game login

After the player has successfully logged in, the developer can use MiracleGames.User.AuthenticationManager.UserProfile.Id as the player's unique identifier and then complete the in-game login.

Server Verify Player Login Status Interface

Video Demonstration - Login