Using Custom Authentication in PnP Unreal Engine SDK
Custom Authentication is a way to authenticate users with your custom authentication service. For example, while authenticating with Google, you can use your own Google Client ID to authenticate users directly.
This feature, with MFA turned off, can even make Web3Auth invisible to the end user.
This is a paid feature and the minimum pricing plan to use this SDK in a production environment is the Growth Plan. You can use this feature in Web3Auth Sapphire Devnet network for free.
Getting an Auth Connection ID
To enable this, you need to Create a Connection from the Authentication tab of your project from the Web3Auth Developer Dashboard with your desired configuration.
To configure a connection, you need to provide the particular details of the connection into our Web3Auth Dashboard. This enables us to map a authConnectionId
with your connection details. This authConnectionId
helps us to identify the connection details while initializing the SDK. You can configure multiple connections for the same project, and you can also update the connection details anytime.
Visit the Auth Provider Setup page to learn more about to setup the different configurations available for each connection.
Configuration
"Auth Connection" is called "Verifier" in the Android SDK. It is the older terminology which we will be updating in the upcoming releases.
Consequentially, you will see the terms "Verifier ID" and "Aggregate Verifier" used in the codebase and documentation referring to "Auth Connection ID" and "Grouped Auth Connection" respectively.
To use custom authentication (Using Social providers or Login providers like Auth0, AWS Cognito, Firebase etc. or even your own custom JWT login) you can add the configuration using loginConfig
parameter during the initialization.
The loginConfig
field is a key value map. The key should be one of the Web3AuthProvider
in its string form, and the value should be a LoginConfigItem
struct instance.
Arguments
LoginConfigItem
- Table
- Interface
Parameter | Description |
---|---|
verifier | The name of the verifier that you have registered on the Web3Auth Dashboard. It's a mandatory field, and accepts FString as a value. |
typeOfLogin | Type of login of this verifier, this value will affect the login flow that is adapted. For example, if you choose google , a Google sign-in flow will be used. If you choose jwt , you should be providing your own JWT token, no sign-in flow will be presented. It's a mandatory field, and accepts FTypeOfLogin as a value. |
clientId | Client id provided by your login provider used for custom verifier. e.g. Google's Client ID or Web3Auth's client Id if using 'jwt' as TypeOfLogin. It's a mandatory field, and accepts FString as a value. |
name? | Display name for the verifier. If null, the default name is used. It accepts FString as a value. |
description? | Description for the button. If provided, it renders as a full length button. else, icon button. It accepts FString as a value. |
verifierSubIdentifier? | The field in JWT token which maps to verifier id. Please make sure you selected correct JWT verifier id in the developer dashboard. It accepts FString as a value. |
logoHover? | Logo to be shown on mouse hover. It accepts FString as a value. |
logoLight? | Light logo for dark background. It accepts FString as a value. |
logoDark? | Dark logo for light background. It accepts FString as a value. |
mainOption? | Show login button on the main list. It accepts bool as a value. Default value is false. |
showOnModal? | Whether to show the login button on modal or not. Default value is true. |
showOnDesktop? | Whether to show the login button on desktop. Default value is true. |
showOnMobile? | Whether to show the login button on mobile. Default value is true. |
USTRUCT(BlueprintType)
struct FLoginConfigItem
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString verifier;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString typeOfLogin;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString name;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString description;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString clientId;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString verifierSubIdentifier;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString logoHover;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString logoLight;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString logoDark;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool mainOption;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool showOnModal;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool showOnDesktop;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool showOnMobile;
FLoginConfigItem() {};
bool operator== (const FLoginConfigItem& other) {
return other.clientId == clientId;
}
};
TypeOfLogin
UENUM(BlueprintType)
enum class FTypeOfLogin : uint8
{
GOOGLE,
FACEBOOK,
REDDIT,
DISCORD,
TWITCH,
APPLE,
LINE,
GITHUB,
KAKAO,
LINKEDIN,
TWITTER,
WEIBO,
WECHAT,
EMAIL_PASSWORDLESS,
EMAIL_PASSWORD,
JWT
};
Usage
- Email Passwordless
- Auth0
-
dApp Share is only returned for the Custom Authentication verifiers.
-
Also, 2FA should be enabled for the account using it.
Use
mfaLevel = MFALevel.MANDATORY
in theLoginParams
during login. See MFA for more details.