FCavrnusAuthentication (Unreal Engine)

Structure to hold authentication data.

Navigation

Cavrnus C++ API Reference > Cavrnus Types

References

Module

CavrnusSpatialConnector

Header

<Project>/Plugins/CavrnusConnector/Source/CavrnusConnector/Public/Types/CavrnusAuthentication.h

Include

#include “Types/CavrnusAuthentication.h”

Syntax

struct FCavrnusAuthentication(const FString& Token) : Token(Token)

Variables

 

Type

Name

Description

 

Type

Name

Description

 

FString

Token

The authentication token received after a successful login.

Constructors

 

Type

Name

Description

 

Type

Name

Description

 

 

FCavrnusAuthentication(const FString& Token)
: Token(Token

  • Constructor to initialize the FCavrnusAuthentication with a given token.

  • @param Token The authentication token

Remarks

The FCavrnusAuthentication structure contains the token received from a successful login attempt.

  • The Token parameter stores the reference from the server as an FString upon a successful login.

  • The Token value can be stored locally to keep a user logged in. However, the CavrnusSpatialConnector component already does this for you, so this isn’t useful unless you wanted to re-build or customize that functionality for whatever reason.

  • You can only ever have one active login at a time.

  • The FCavrnusAuthentication is what is received as the result of a successful login attempt.

    • However, you don’t actually need to do anything with the FCavrnusAuthentication is most cases. So at the moment, outside of just existing, this class doesn’t really “do” anything.

Sample Code

#include "CavrnusFunctionLibrary.h" #include "Types/CavrnusAuthentication.h" // ... (Other includes and class definitions) void AMyActor::HandleLoginResult(FCavrnusAuthentication AuthResult, bool bWasSuccessful) { if (bWasSuccessful) { // Login successful! // Store the authentication token for potential later use FString MyAuthToken = AuthResult.Token; // Optionally, save the token to persistent storage for future logins // ... (Proceed with joining spaces or other actions) } else { // Handle login failure UE_LOG(LogTemp, Warning, TEXT("Login failed.")); } } void AMyActor::AttemptLogin(const FString& Email, const FString& Password) { // Initiate login with Cavrnus (using the function library) UCavrnusFunctionLibrary::AuthenticateWithPassword( Email, Password, FOnAuthenticateDelegate::CreateUObject(this, &AMyActor::HandleLoginResult) ); }