# Get started

> Follow this workflow to create a Unity account, link your project, and install the SDK to get started with Unity Authentication.

To use Authentication, you need to:

1. [Create a Unity account](/cloud/accounts/create-account.md) if you don't already have one.
2. [Link your Unity Editor project to a Unity cloud project](/cloud/projects/configure-project-for-unity-cloud.md).
3. Install the SDK in your game code.
4. Initialize the SDK.

## Install the SDK

To install the latest Authentication package for Unity:

1. In the Unity Editor, open **Window** > **Package Manager**.
2. In the Package Manager, select the **Unity Registry** list view.
3. Search for **Authentication**, or locate it in the package list.
4. Select the package, then select **Install**.

Refer to the [Package Manager](https://docs.unity3d.com/Manual/upm-ui.html) documentation for more information.

## Initialize the Unity Services SDK

To implement Unity Authentication in your game, [initialize all the Unity Services SDKs](/services/getting-started.md) included in the project following this code snippet:

```cs
using System;
using Unity.Services.Core;
using UnityEngine;

public class InitializationExample : MonoBehaviour
{
	async void Awake()
	{
		try
		{
			await UnityServices.InitializeAsync();
		}
		catch (Exception e)
		{
			Debug.LogException(e);
		}
	}
}
```

### Register authentication events

To receive updates about the status of your player, register a function to the `SignedIn`, `SignInFailed` and `SignedOut` event handlers.

```cs
// Setup authentication event handlers if desired
void SetupEvents() {
  AuthenticationService.Instance.SignedIn += () => {
    // Shows how to get a playerID
    Debug.Log($"PlayerID: {AuthenticationService.Instance.PlayerId}");

    // Shows how to get an access token
    Debug.Log($"Access Token: {AuthenticationService.Instance.AccessToken}");

  };

  AuthenticationService.Instance.SignInFailed += (err) => {
    Debug.LogError(err);
  };

  AuthenticationService.Instance.SignedOut += () => {
    Debug.Log("Player signed out.");
  };

  AuthenticationService.Instance.Expired += () =>
    {
        Debug.Log("Player session could not be refreshed and expired.");
    };
}
```
