iOS Signup and Authentication
Sign up and authenticate using Apple ID.
URL Confirmation
This API uses the service-account.playnanoo.com domain.
Apple Authentication Plugin Registration
Utilize Unreal Engine's Online Subsystem Apple or use a third-party plugin.
API Information
- URL:
https://service-account.playnanoo.com/api/v20240101/social/signin - Method:
PUT - Authentication Required: No
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| account_token | string | Required | Social login token (Apple ID Token) |
| account_type | string | Required | Account type (PN_ACCOUNT_APPLE_ID = "APPLE ID") |
Response Data
Res Structure
| Field | Type | Description |
|---|---|---|
| Token | FSerializeTokenData | Token information |
| Player | FSerializePlayerData | Player information |
FSerializeTokenData Structure
| Field | Type | Description |
|---|---|---|
| AccessToken | FString | Access token |
| RefreshToken | FString | Refresh token |
FSerializePlayerData Structure
| Field | Type | Description |
|---|---|---|
| UserUniqueID | FString | User unique ID |
| OpenID | FString | Open ID |
| Nickname | FString | Nickname |
| LinkedID | FString | Linked ID |
| LinkedType | FString | Linked type |
| PurchaseCount | int32 | Purchase count |
| PurchaseCurrencyCode | FString | Purchase currency code |
| PurchaseTotalPrice | double | Total purchase amount |
| PurchaseVoidedCount | int32 | Refund count |
| PurchaseVoidedCurrencyCode | FString | Refund currency code |
| PurchaseVoidedTotalPrice | double | Total refund amount |
| Country | FString | Country |
| Timezone | FString | Timezone |
| Offset | int32 | Time offset |
| JoinPeriod | int32 | Join period |
Unreal C++ Implementation
// AppleSignInExample.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AppleSignInExample.generated.h"
UCLASS()
class YOURPROJECT_API AAppleSignInExample : public AActor
{
GENERATED_BODY()
public:
AAppleSignInExample();
UFUNCTION(BlueprintCallable, Category = "PlayNANOO|Account")
void SignIn();
private:
void OnAppleSignInComplete(const FString& IdToken);
void SocialSignin(const FString& Token);
};
// AppleSignInExample.cpp
#include "AppleSignInExample.h"
#include "OnlineSubsystem.h"
#include "OnlineSubsystemApple.h"
#include "Interfaces/OnlineIdentityInterface.h"
AAppleSignInExample::AAppleSignInExample()
{
PrimaryActorTick.bCanEverTick = false;
}
void AAppleSignInExample::SignIn()
{
IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get(APPLE_SUBSYSTEM);
if (OnlineSubsystem)
{
IOnlineIdentityPtr Identity = OnlineSubsystem->GetIdentityInterface();
if (Identity.IsValid())
{
FOnLoginCompleteDelegate LoginDelegate = FOnLoginCompleteDelegate::CreateLambda(
[this](int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
if (bWasSuccessful)
{
// Get Apple ID Token
IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get(APPLE_SUBSYSTEM);
if (OnlineSubsystem)
{
IOnlineIdentityPtr Identity = OnlineSubsystem->GetIdentityInterface();
if (Identity.IsValid())
{
FString IdToken = Identity->GetAuthToken(LocalUserNum);
OnAppleSignInComplete(IdToken);
}
}
}
else
{
UE_LOG(LogTemp, Error, TEXT("Apple authentication failed: %s"), *Error);
}
}
);
Identity->AddOnLoginCompleteDelegate_Handle(0, LoginDelegate);
Identity->Login(0, FOnlineAccountCredentials());
}
}
}
void AAppleSignInExample::OnAppleSignInComplete(const FString& IdToken)
{
// Call SocialSignin API
SocialSignin(IdToken);
}
void AAppleSignInExample::SocialSignin(const FString& Token)
{
// SocialSignIn(Token, TEXT("APPLE ID"));
UE_LOG(LogTemp, Log, TEXT("Apple ID Token: %s"), *Token);
}
Usage
1. Start Apple Login
void UYourClass::StartAppleSignIn()
{
AAppleSignInExample* AppleSignIn = GetWorld()->SpawnActor<AAppleSignInExample>();
if (AppleSignIn)
{
AppleSignIn->SignIn();
}
}
2. Link Account with Token
Call the PlayNANOO API with the token received in the SocialSignin method after authentication:
New Login (SocialSignIn)
void UYourClass::SocialSignIn(const FString& Token, const FString& AccountType)
{
// First login with Apple account
// AccountType: "APPLE ID"
}
Reference
- Account Type Value:
PN_ACCOUNT_APPLE_ID = "APPLE ID"- See Etc > Account Type Information for more details - Account Conversion: Refer to Guest > Account Conversion documentation
Online Subsystem Apple
To use Unreal Engine's Online Subsystem Apple, you must enable it in project settings and configure appropriate settings. Refer to the Unreal Engine official documentation for more details.