User
HeathenEngineering.BGSDK.API.User
2021-10-05
The Venly authentication methods are temporarily deprecated as per Venly request. If you have any questions or need more support around authentication through the Venly APIs please contact Venly.
1
HeathenEngineering.BGSDK.API.User
Copied!
A wrapper around user features such as authentication and user data.
How to authenticate
Venly API

Overview

The User static class is primarily used to authenticate the current user against the Arkane backend service.
You can only perform API actions after a user has been authenticated. The system stores the authenticated user in memory at:
1
public static Identity BGSDKSettings.user;
Copied!
This is used by all other methods from its static accessor.

Get Profile

1
public static IEnumerator GetProfile(Action<UserProfileResult> callback);
Copied!
Returns data related to the authenticated user via the UserProfile object.

Examples

These examples assume you are familiar with the use of Unity Co-routines and the basics of C# in the context of Unity.
1
StartCoroutine(API.User.GetProfile((requestState) =>
2
{
3
if (!requestState.hasError)
4
{
5
Debug.Log("Found " + requestState.result.username+ "'s profile");
6
}
7
}));
Copied!

Login 3rd Party Authentication

Sets the BGSDKSettings.user to the authenticated identify as provided in the input parameters of this method.
1
public static void Login_3rdPartyAuthentication(DateTime createdAt,
2
string accessToken,
3
int expiresIn,
4
string refreshToken,
5
int refreshExpiresIn);
Copied!
This is used to record an authentication token acquired from a 3rd party source, such as a web pass through in Unity memory for use on subsequent API calls. In order to use this you will need to use the Arkane Web API or similar method by which you can retrieve a valid Arkane access token.

Examples

1
API.User.Login_3rdPartyAuthentication(DateTime.Now,
2
accessToken,
3
expiresIn,
4
refreshToken,
5
refreshExpiresIn);
Copied!

Login Facebook

Sets the BGSDKSettings.user to the authenticated identify as provided in the input parameters of this method.
1
public static IEnumerator Login_Facebook(string token,
2
Action<AuthenticationResult> callback);
Copied!
Exchanges a Facebook identity token via the Arkane Web API, this assumes you already have a Facebook identity token.

Examples

1
StartCoroutine(API.User.Login_Facebook(token, (requestState) =>
2
{
3
if (!requestState.hasError)
4
{
5
Debug.Log("User is Authenticated");
6
}
7
}));
Copied!
Last modified 1mo ago