CBSAuthModule.LoginWithMailAndPassword - Authorization using login and password. No automatic registration. Before login, you need to register
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var loginRequest = new CBSMailLoginRequest
{
Mail = "your mail" ,
Password = "your password"
};
CBSAuth . LoginWithMailAndPassword (loginRequest , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithCustomID - Authorization using your own custom identifier. Auto-register user if there is no such user in the database.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var customID = "your custom id" ;
CBSAuth . LoginWithCustomID (customID , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithDevice - Authorization that binds the account with the current ID of the device on which the application was launched. Auto-register user if there is no such user in the database.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . LoginWithDevice (OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithGoolge - Authorization with google account. Required server auth code.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var googleAuthCode = "your google auth code" ;
CBSAuth . LoginWithGoolge (googleAuthCode , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithSteam - Authorization with Steam account. Required steam ticket.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var steamTicket = "your steam ticket" ;
CBSAuth . LoginWithSteam (steamTicket , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithFacebook - Authorization with Facebook account. Required access token.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var accessToken = "facebook access token" ;
CBSAuth . LoginWithFacebook (accessToken , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithApple - Authorization with Apple account. Required apple identity Token.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var identityToken = "apple identity token" ;
CBSAuth . LoginWithApple (identityToken , OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LoginWithOpenID - Login with open id connection. Required connection id and id token.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class AuthExample : MonoBehaviour
{
private IAuth AuthModule { get ; set ; }
void Start ()
{
AuthModule = CBSModule . Get < CBSAuthModule >();
var connectionID = "connection id" ;
var idToken = "id token" ;
AuthModule . LoginWithOpenID (connectionID , idToken , OnProfileLogined);
}
private void OnProfileLogined ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.AutoLogin - Authorization based on the last successful login. Enable this setting in CBS Configurator-> Configurator-> Auth-> Enable AutoLogin
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . AutoLogin (OnLogin);
}
private void OnLogin ( CBSLoginResult result)
{
if ( result . IsSuccess )
{
var isNew = result . IsNew ;
var profileID = result . ProfileID ;
var playfabLoginResult = result . Result ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.RegisterWithMailAndPassword - User registration using mail and password. Auto generation of the name is not applied. The name must be specified in the request.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var registerRequest = new CBSMailRegistrationRequest
{
Mail = "mail" ,
Password = "pass" ,
DisplayName = "name"
};
CBSAuth . RegisterWithMailAndPassword (registerRequest , OnRegister);
}
private void OnRegister ( BaseAuthResult result)
{
if ( result . IsSuccess )
{
var profileID = result . ProfileID ;
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.SendPasswordRecovery - Recovering a player's password using mail. Works only for users who have registered using mail and password.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var mail = "your mail" ;
CBSAuth . SendPasswordRecovery (mail , OnRecovery);
}
private void OnRecovery ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LinkFacebookAccount - Link existing account with Facebook.
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var accessToken = "facebook access token" ;
CBSAuth . LinkFacebookAccount (accessToken , OnAccountLinked);
}
private void OnAccountLinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LinkGoogleAccount - Link existing account with Google
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var authCode = "google auth code" ;
CBSAuth . LinkGoogleAccount (authCode , OnAccountLinked);
}
private void OnAccountLinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LinkAppleAccount - Link existing account with Apple
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var identityToken = "apple identity token" ;
CBSAuth . LinkAppleAccount (identityToken , OnAccountLinked);
}
private void OnAccountLinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.LinkSteamAccount - Link existing account with Steam
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
var steamTicket = "your steam ticket" ;
CBSAuth . LinkSteamAccount (steamTicket , OnAccountLinked);
}
private void OnAccountLinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.UnlinkFacebookAccount - Unlink existing account from Facebook
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . UnlinkFacebookAccount (OnAccountUnlinked);
}
private void OnAccountUnlinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.UnlinkGoogleAccount - Unlink existing account from Google
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . UnlinkGoogleAccount (OnAccountUnlinked);
}
private void OnAccountUnlinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule.UnlinkAppleAccount - Unlink existing account from Apple
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . UnlinkAppleAccount (OnAccountUnlinked);
}
private void OnAccountUnlinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}
CBSAuthModule. UnlinkSteamAccount - Unlink existing account from Steam
Copy using CBS ;
using CBS . Models ;
using UnityEngine ;
public class NewBehaviourScript : MonoBehaviour
{
private IAuth CBSAuth { get ; set ; }
private void Start ()
{
CBSAuth = CBSAuthModule . Get < CBSAuthModule >();
CBSAuth . UnlinkSteamAccount (OnAccountUnlinked);
}
private void OnAccountUnlinked ( CBSBaseResult result)
{
if ( result . IsSuccess )
{
Debug . Log ( "Success!" );
}
else
{
Debug . Log ( result . Error . Message );
}
}
}