BrainCloudWrapper
The BrainCloudWrapper class provides an easier way for developers to handle user authentication when they are getting started with the authentication system. This includes persisting authentication data between application runs.
By using the wrapper authentication methods, the anonymous and profile IDs will be automatically persisted upon successful authentication. When authenticating, any stored anonymous/profile IDs will be sent to the server. This strategy is useful when using Anonymous authentication.
Note - you should initialize the wrapper before using it. It will in turn initialize the brainCloud client for you - don't do both!
Method Parameters
| Parameter | Description |
|---|---|
| wrapperName | Distincts saved wrapper data. Use when using more than one instance of brainCloud |
Usage
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
// Unity
//Note: Ensure of have selected your app using the brainCloud Unity Plugin
using UnityEngine;
public class BCConfig : MonoBehaviour {
private BrainCloudWrapper _bc;
public BrainCloudWrapper Get()
{
return _bc;
}
void Awake ()
{
DontDestroyOnLoad(gameObject);
_bc = gameObject.AddComponent<BrainCloudWrapper>();
_bc.WrapperName = gameObject.name; // Optional: Set a wrapper name
_bc.Init(); // Init data is taken from the brainCloud Unity Plugin
}
}
// C#
_bc = new BrainCloudWrapper("_mainWrapper");
_bc = new BrainCloudWrapper("_mainWrapper");
_bc = [[BrainCloudWrapper alloc] init: @"_mainWrapper"]
_bc = new BrainCloudWrapper("_mainWrapper");
_bc = new BrainCloudWrapper("_mainWrapper");
BrainCloudWrapper _bc = BrainCloudWrapper(wrapperName: "_mainWrapper");
📄️ AuthenticateAdvanced
A generic Authenticate method that translates to the same as calling a specific one, except it takes an extraJson that will be passed along to pre- or post- hooks.
📄️ AuthenticateAnonymous
Authenticate a user anonymously with - used for apps that don't want to bother the user to login, or for users who are sensitive to their privacy.
📄️ AuthenticateApple
Authenticates the user using Sign in with Apple.
📄️ AuthenticateEmailPassword
Authenticate the user with a custom Email and Password. Note that the client app is responsible for collecting (and storing) the e-mail and potentially password (for convenience) in the client data. For the greatest security, force the user to re-enter their password at each login (or at least give them that option).
📄️ AuthenticateExternal
Authenticate the user via cloud code (which in turn validates the supplied credentials against an external system).
📄️ AuthenticateFacebook
Authenticate the user with using their Facebook Credentials.
📄️ AuthenticateFacebookLimited
Authenticate the user with using their Facebook Credentials.
📄️ AuthenticateGameCenter
Authenticate the user using their Game Center ID.
📄️ AuthenticateGoogle
Authenticate the user using a google user ID (gXXX) and google authentication token.
📄️ AuthenticateGoogleOpenId
Authenticate the user using a google user ID (gXXX) and google authentication token.