Skip to content

Login with SohaGame SDK

Overview

This guide explains how to integrate with Login for iOS. Once authenticated users authorize your game, you can access their data including their display name and avatar.

Before you begin

You will need to Integrate the SohaGame SDK for iOS into your game.

Login

Call loginWithCallback method:

[SohaSDK loginWithCallback:^(SohaUser *user, NSError *error) {
    //Handle login callback
}];

Authenticate user

There are 2 ways for you to authenticate users

  • Service To Service (S2S) Authentication (Recommend).
    After obtaining the access token, the game will send it to the game server, then the game server will push a request to the SohaGame server to verify the account information being logged

API documentation for S2S Authentication can be see here

  • Use userId for authentication.

Logout

Call logout method:

[SohaSDK logout];
The SDK will handle the logout, the successful logout will be returned via the following delegate:
- (void)sohaDidLogoutSuccess:(SohaUser *)user {
    NSLog(@"sohaDidLogoutSuccess : %@",user);
}

It is required to handle ingame logout in this delegate.

Delete Account

From June 30, 2022, Apple has required the account deletion feature in app. See more here The SDK already supports account deletion.

First, you need a "Delete account" button in the ingame interface.

When the user clicks this button, call the following method:

[SohaSDK deleteAccount];
The sohaDidDeleteAccountSuccess method of SohaDelegate protocol will be invoked when successful account deletion.

- (void)sohaDidDeleteAccountSuccess:(SohaUser *)user{
    /// logout game
}