# Morpheus UserID

## UserID Replication Component

The `M2_UserIDReplicationComponent` is a Morpheus Actor Component added to all `M2M_CharacterBase` classes. It is used to inform the server of the character's web platform UserId, since this information comes from the local client.

On the server, you can call `HandleUserIdReplicatedToServer` to trigger a callback with the UserId once it has been obtained. (If this is called after the UserId has already been obtained, the callback will trigger immediately).

Once you are certain that the UserId has been obtained, you can subsequently use `GetUserIdAsString`.

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-4d2009b2fde99a7f2b787ff5eccd92ab20ac63d5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

On the auth client, you can instead obtain the local User ID directly from the `M2_WebServiceProfileDataProvider` world service (see [world-services](https://docs.msquared.io/creation/unreal-development/features-and-tutorials/helpers-and-extras/world-services "mention"))

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-631fc76beba4c5f74e08c52382870238b8ec5a9d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## UserID to Morpheus Actor

Each authenticated user in Morpheus should have a `UserID` but how to obtain the `MorpheusActor` that represents this `UserID` in the game world?

### UserID Tracker Subsystem

The `UserIDTrackerSubsystem` is a `World`Subsystem that tracks player `MorpheusActors` and their `UserIDs` . It contains a mapping between a `UserID` to the user's currently active `MorpheusActor` if the User exists in the game world.

For example, you can do this in Blueprints to obtain the `MorpheusActor` belonging to a given `UserID` and vice versa.

{% @blueprintue-embed/embed url="<https://nextjs-boilerplate-jl63.vercel.app/ee83d0b8-7778-4323-8c2d-a5ea020ab7ec>" %}
