유저 정보 확인
로그인이 완료되었다면 로그인된 유저의 프로필 정보 및 이용 정지 정보를 확인할 수 있습니다.
유저 프로필 노출¶
Hive SDK는 앱에서 사용자 프로필을 웹뷰로 노출하는 기능을 제공합니다. 프로필 화면을 노출하려면 다음 과정을 따라야합니다.
- 프로필을 노출할 수 있는 버튼 또는 UI 요소를 개발사가 앱에 구현합니다.
- 사용자가 앱에서 이 버튼 또는 UI 요소를 선택하면
AuthV4.showProfile을 호출하도록 Hive SDK 인증 기능을 활용해 앱을 구현합니다.
AuthV4.showProfile를 호출하면 Hive SDK에서 제공하는 프로필 화면이 노출됩니다. 사용자는 프로필 화면에서 프로필 이미지와 별명을 확인하고 변경할 수 있습니다.
다음은 프로필을 노출하는 예제 코드입니다.
API Reference: AuthV4.showProfile
API Reference: AuthV4::showProfile
API Reference: AuthV4.showProfile
API Reference: AuthV4.INSTANCE.showProfile
API Reference: AuthV4Interface.showProfile
API Reference: [HIVEAuthV4 showProfile]
프로필 화면 사용은 기본적으로 개발사의 선택입니다. 하지만, 만약 Hive 멤버십 IdP를 제공한다면, 반드시 showProfile()을 구현해야 합니다. 왜냐하면, Hive 멤버십은 아래와 같이 프로필 화면에 있는 Hive 계정 설정에서 비밀번호 변경과 탈퇴 기능을 제공하기 때문입니다.
| Hive 멤버십 IdP 연동 상태의 프로필 | 게스트 및 다른 IdP 연동 상태의 프로필 |
|---|---|
![]() | ![]() |
Hive 멤버십 IdP가 아닌 다른 IdP만을 제공하더라도, 프로필 화면을 노출하면 해외 로그인 차단, 전체 로그아웃, 로그인 기록 확인 등 보안 기능을 제공할 수 있습니다. 따라서, showProfile()을 사용한 프로필 화면 노출 구현을 권장합니다.
Note
Facebook 등 프로필 이미지와 닉네임을 반환하는 IdP와 연동한 경우, 해당 IdP에서 제공한 이미지와 닉네임을 프로필에 자동으로 불러옵니다.
유저 프로필 확인¶
로그인을 완료하였다면 AuthV4 클래스의 getProfile() 메서드를 이용하여 유저의 프로필 정보를 가져올 수 있습니다. 프로필 정보에는 playerId, 외부에 보여질 유저의 닉네임인 playerName, 유저의 섬네일 이미지인 playerImageUrl을 포함하고 있습니다.
다음은 유저의 프로필 정보를 획득하는 예제 코드입니다.
API Reference: hive.AuthV4.getProfile
using hive;
List<Int64> playerIdList = new List();
playerIdList.Add(0123);
playerIdList.Add(4567);
AuthV4.getProfile(playerIdList, (ResultAPI result, List profileInfoList) => {
if (!result.isSuccess()) {
return;
}
if (profileInfoList != null) {
foreach (ProfileInfo profileInfo in profileInfoList) {
// PlayerName: profileInfo.playerName
// PlayerId: profileInfo.playerId
}
}
});
#include "HiveAuthV4.h"
TArray<int64> PlayerIdArray;
PlayerIdArray.Add(1234);
PlayerIdArray.Add(5678);
FHiveAuthV4::GetProfile(PlayerIdArray, FHiveAuthV4OnGetProfileDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveProfileInfo> ProfileInfoArray) {
if (!Result.IsSuccess()) {
return;
}
for (const auto& ProfileInfo : ProfileInfoArray)
{
// PlayerName: ProfileInfo.PlayerName;
// PlayerId : ProfileInfo.ProfileInfo;
}
}));
API Reference: AuthV4::getProfile
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
vector<PlayerID> playerIdList;
playerIdList.push_back(0123);
playerIdList.push_back(4567);
AuthV4::getProfile(playerIdList, [=](ResultAPI const & result, vector<ProfileInfo> const & profileInfoList) {
if (!result.isSuccess()) {
return;
}
if (profileInfoList != null) {
for (auto profileInfo : profileInfoList) {
// PlayerName: profileInfo.playerName
// PlayerId: profileInfo.playerId
}
}
});
API Reference: AuthV4.getProfile
import com.hive.AuthV4
import com.hive.ResultAPI
val playerIdList = arrayListOf<Long>(
1234,
4567
)
AuthV4.getProfile(playerIdList, object : AuthV4.AuthV4GetProfileListener {
override fun onAuthV4GetProfile(result: ResultAPI, profileInfoList: ArrayList<AuthV4.ProfileInfo>?) {
if (!result.isSuccess) {
return
}
if (profileInfoList != null) {
for (i in 0 until profileInfoList.size) {
// PlayerName: profileInfoList[i].playerName
// PlayerId: profileInfoList[i].playerId
}
}
}
})
API Reference: com.hive.AuthV4.getProfile
import com.hive.AuthV4;
import com.hive.ResultAPI;
ArrayList<Long> playerIdList = new ArrayList<>(Arrays.asList(
1234L,
5678L
));
AuthV4.INSTANCE.getProfile(playerIdList, (result, profileInfoList) -> {
if (!result.isSuccess()) {
return;
}
if (profileInfoList != null) {
for (AuthV4.ProfileInfo profileInfo : profileInfoList) {
// PlayerName: profileInfo.getPlayerName();
// PlayerId: profileInfo.getPlayerId();
}
}
});
API Reference: AuthV4Interface.getProfile
import HIVEService
var playerIdList = [Int64]()
playerIdList.append(0123)
playerIdList.append(4567)
AuthV4Interface.getProfile(playerIdList) { result, profileInfoList in
if !result.isSuccess() {
return
}
if let profileInfoList = profileInfoList {
for (profileInfo in profileInfoList) {
// PlayerName: profileInfo.playerName
// PlayerId: profileInfo.playerId
}
}
}
API Reference: HIVEAuthV4:getProfile
#import <HIVEService/HIVEService-Swift.h>
NSMutableArray<NSNumber *> *playerIdList = [[[NSMutableArray] alloc] init];
[playerIdList addObject: [NSNumber numberWithLongLong:0123]];
[playerIdList addObject: [NSNUmber numberWithLongLong:4567]];
[HIVEAuthV4 getProfile: playerIdList handler: ^(HIVEResultAPI *result, NSArray<HIVEProfileInfo *> *profileInfoList) {
if (![result isSuccess]) {
return;
}
if (profileInfoList != nil) {
for (HIVEProfileInfo *profileInfo in profileInfoList) {
// PlayerName: profileInfo.playerName
// PlayerId: profileInfo.playerId
}
}
}];
이용 정지 상태 확인¶
로그인 및 IdP 연동 시에는 Hive에서 유저 이용 정지 여부를 자동으로 확인하고 게임을 진행하지 못하도록 처리합니다. 그 외 게임 진행 중 이용 정지 상태를 확인해야 하는 경우에는 checkBlacklist() 메서드를 이용, 게임에서 유저의 이용 정지 상태를 실시간으로 확인하고 게임을 진행하지 못하도록 처리해야 합니다. checkBlacklist() 호출 시 isShow 파라미터 값에 따라 Hive는 이용 정지 팝업을 직접 띄우기도 하고, 혹은 여러분이 이용 정지 팝업을 구성하여 띄울 수 있도록 팝업에 채울 내용을 반환하기도 합니다.
-
- Hive가 제공하는 이용 정지 팝업 이용하기: `isShow` 파라미터를 `true`로 설정하세요.
- 이용 정지 팝업 커스터마이징 하기: `isShow` 파라미터를 `false`로 설정하세요. 이용 정지 팝업 정보에 대한 자세한 내용은 하단의 Hive가 반환하는 이용 정지 팝업 정보를 참고하세요.
Hive가 반환하는 이용 정지 팝업 정보¶
checkBlacklist()의 결과가 성공 시 다음의 표에 정리된 값들을 AuthV4MaintenanceInfo 오브젝트에 담아 반환합니다.
| 필드명 | 설명 | 타입 |
| title | 팝업 제목 | String |
| message | 팝업 내용 | String |
| button | 팝업 버튼의 라벨 문구 | String |
| action | 팝업 버튼을 눌렀을 때 어떤 동작을 할 것인지 의미
| AuthV4MaintenanceActionType 열거형 |
| url | 외부 브라우저로 띄울 URL. action 필드 값이 OPEN_URL일 때 유효함 | String |
| remainingTime | 이용 정지까지 남은 초단위 시간. 시간은 실시간 갱신되며 0초가 되면 앱이 종료됨 | Integer |
다음은 이용 정지 유저를 확인하는 예제 코드입니다.
- Hive UI를 사용하지 않을 경우 (isShow = false)
API Reference: hive.AuthV4.checkBlacklist
using hive;
Boolean isShow = false;
AuthV4.checkBlacklist(isShow, (ResultAPI result, List<AuthV4.MaintenanceInfo> maintenanceInfo) => {
if (!result.isSuccess()) {
// Request to check for suspension failed
return;
}
if(maintenanceInfo != null){
// In case of suspended user
} else{
// If you are a general user
}
});
#include "HiveAuthV4.h"
bool bIsShow = false;
FHiveAuthV4::CheckBlacklist(bIsShow,
FHiveAuthV4OnMaintenanceInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveAuthV4MaintenanceInfo>& AuthV4MaintenanceInfoArray) {
if (!Result.IsSuccess()) {
// 이용 정지 여부 확인 실패
return;
}
if (AuthV4MaintenanceInfoArray.Num() > 0) {
// 이용 정지 유저인 경우
} else {
// 일반 유저인 경우
}
}));
API Reference: AuthV4.checkBlacklist
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
bool isShow = false;
AuthV4::checkBlacklist(isShow, [=](ResultAPI const & result, vector<AuthV4MaintenanceInfo> const & maintenanceInfo) {
if(!result.isSuccess) {
// Request to check for suspension failed
return;
}
if (maintenanceInfo != null){
// In case of suspended user
} else {
// If you are a general user
}
});
API Reference: AuthV4.checkBlacklist
import com.hive.AuthV4
import com.hive.ResultAPI
val isShow = false
AuthV4.checkBlacklist(isShow, object : AuthV4.AuthV4MaintenanceListener {
override fun onAuthV4Maintenance(result: ResultAPI, maintenanceInfo: ArrayList<AuthV4.AuthV4MaintenanceInfo>?) {
if (!result.isSuccess) {
// Request to check for suspension failed
return
}
if (maintenanceInfo != null) {
// In case of suspended user
} else {
// If you are a general user
}
}
})
API Reference: com.hive.AuthV4.checkBlacklist
import com.hive.AuthV4;
import com.hive.ResultAPI;
boolean isShow = false;
AuthV4.INSTANCE.checkBlacklist(isShow, (result, maintenanceInfo) -> {
if (!result.isSuccess()) {
// Request to check for suspension failed
return;
}
if (maintenanceInfo != null) {
// In case of suspended user
} else {
// If you are a general user
}
});
API Reference: AuthV4Interface.checkBlacklist
API Reference: HIVEAuthV4:checkBlacklist
#import <HIVEService/HIVEService-Swift.h>
BOOL isShow = NO;
[HIVEAuthV4 checkBlackList: isShow handler: ^(HIVEResultAPI *result, HIVEAuthV4MaintenanceInfo *maintenanceInfo) {
if (![result isSuccess]) {
// Request to check for suspension failed
return;
}
if (maintenanceInfo != nil) {
// In case of suspended user
} else {
// If you are a general user
}
}];
- Hive UI를 사용할 경우 (isShow = true)
API Reference: hive.AuthV4.checkBlacklist
// If isShow is true, Hive SDK displays suspension popup.
Boolean isShow = true;
// Hive SDK AuthV4 requests to check whether suspended user or not.
AuthV4.checkBlacklist(isShow, (ResultAPI result, List<AuthV4.MaintenanceInfo> maintenanceInfo)=>{
if (result.isSuccess()) {
// In case of normal user
} else if (result.needExit()) {
// TODO: Implement the termination of the app.
// Example) Application.Quit(); }});
#include "HiveAuthV4.h"
// IsShow 값이 true 이면 Hive SDK 내부에서 이용 정지 팝업을 띄운다.
bool bIsShow = true;
// Hive SDK AuthV4 이용 정지 유저 확ㅇ니 요청
FHiveAuthV4::CheckBlacklist(bIsShow,
FHiveAuthV4OnMaintenanceInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveAuthV4MaintenanceInfo>& AuthV4MaintenanceInfoArray) {
if (Result.IsSuccess()) {
// 일반 유저인 경우
} else if (Result.NeedExit() {
// TODO: 앱 종료 기능을 구현하세요
// 예) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
}));
API Reference: AuthV4.checkBlacklist
// If isShow is true, Hive SDK displays suspension popup.
bool isShow = true;
// Hive SDK AuthV4 requests to check whether suspended user or not.
AuthV4::checkBlacklist(isShow, [=](ResultAPI const & result,std::vector<AuthV4MaintenanceInfo> const & maintenanceInfolist){
if (result.isSuccess()) {
// In case of normal user
} else if (result.needExit()) {
// TODO: Implement the termination of the app.
// Users of the Cocos2d-x engine
// ex) exit(0);
// Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false); }});
API Reference: AuthV4.checkBlacklist
// If isShow is true, Hive SDK displays suspension popup.
val isShow = true
// Hive SDK AuthV4 requests to check whether suspended user or not.
AuthV4.checkBlacklist(isShow, object : AuthV4.AuthV4MaintenanceListener {
override fun onAuthV4Maintenance(
result: ResultAPI,
maintenanceInfo: ArrayList<AuthV4.AuthV4MaintenanceInfo>? ) { if (result.isSuccess) {
// In case of normal user
} else if (result.needExit()) {
// TODO: Implement the termination of the app.
// Example) exitProcess(0) } }})
API Reference: com.hive.AuthV4.checkBlacklist
// If isShow is true, Hive SDK displays suspension popup.
boolean isShow = true;
// Hive SDK AuthV4 requests to check whether suspended user or not.
AuthV4.checkBlacklist(isShow, new AuthV4.AuthV4MaintenanceListener() {
@Override
public void onAuthV4Maintenance(ResultAPI result, ArrayList<AuthV4.AuthV4MaintenanceInfo> maintenanceInfo) {
if (result.isSuccess()) {
// In case of normal user
} else if (result.needExit()) {
// TODO: Implement the termination of the app.
// Example) System.exit(0); } }});
API Reference: AuthV4Interface.checkBlacklist
// If isShow is true, Hive SDK displays suspension popup.
let isShow = true
// Hive SDK AuthV4 requests to check whether suspended user or not.
AuthV4Interface.checkBlacklist(isShow) { (result, maintenanceInfolist) in
if result.isSuccess() {
// In case of normal user
}
else if result.needExit() {
// TODO: Implement the termination of the app.
// Example) exit(0)
}
API Reference: HIVEAuthV4:checkBlacklist
// If isShow is YES, Hive SDK displays suspension popup.
BOOL isShow = YES;
// Hive SDK AuthV4 requests to check whether suspended user or not.
[HIVEAuthV4 checkBlacklist:isShow handler:^(HIVEResultAPI *result, NSArray<HIVEAuthV4MaintenanceInfo *> *maintenanceInfolist) {
if (result.isSuccess) {
// In case of normal user
} else if (result.needExit) {
// TODO: Implement the termination of the app.
// Example) exit(0); }}];
유저 이메일 정보 활용¶
게임사가 로그인한 사용자 프로필 정보에 있는 이메일 정보를 수집하는 기능을 제공합니다. 이메일 정보를 수집하려면, Hive 콘솔에서 해당 기능을 활성화해야 합니다.
먼저, 아래의 Idp 리스트 중 '이메일 수집 가능 Idp'에서 이메일 수집 권한 승인을 받아야 합니다.
- 이메일 수집 가능 IdP: Google, Facebook, Huawei (Android), Hive 멤버십, Apple (iOS)
- 이메일 수집 불가 IdP: Google Play Games, Apple Game Center, QQ, VK, WeChat, Line, Weverse, Steam, X
명시적 로그인 API 호출 후 콜백으로 전달받는 PlayerInfo 클래스 인스턴스에서 providerInfoData에 접근하면 로그인한 유저 이메일 주소를 확인할 수 있습니다.
ProviderType을 providerInfoData의 키 값으로 사용해 조회하면 ProviderInfo 정보를 확인할 수 있습니다. 자세한 내용은 아래 예제 코드를 참고하세요.
API Reference: hive.AuthV4.showSignIn
// Request Hive SDK AuthV4 Authentication UI
AuthV4.showSignIn((ResultAPI result, AuthV4.PlayerInfo playerInfo)=>{
if (result.isSuccess()) {
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
foreach (KeyValuePair<AuthV4.ProviderType , AuthV4.ProviderInfo> entry in playerInfo.providerInfoData) {
AuthV4.ProviderInfo providerInfo = entry.Value;
if(providerInfo.providerEmail != null && providerInfo.providerEmail != "") {
string email = providerInfo.providerEmail;
break;
}
}
}
else if (result.needExit()) {
// TODO: Implement the termination of the app
// Example) Application.Quit();
}
});
#include "HiveAuthV4.h"
// Hive SDK AuthV4 인증 UI 요청
FHiveAuthV4::ShowSignIn(FHiveAuthV4OnSignInDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHivePlayerInfo& PlayerInfo) {
if (Result.IsSuccess()) {
// 인증 성공 (PlayerInfo: 인증된 사용자 정보)
// 이메일 정보 조회 예시
for (const auto& ProviderInfoEntry : PlayerInfo.ProviderInfoData) {
FHiveProviderInfo ProviderInfo = ProviderInfoEntry.Value;
FString Email = ProviderInfo.ProviderEmail;
}
} else if (Result.NeedExit()) {
// TODO: 앱 종료 기능을 구현하세요
// 예) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
}));
API Reference: AuthV4::showSignIn
// Request Hive SDK AuthV4 Authentication UI
AuthV4::showSignIn([=](ResultAPI const & result, PlayerInfo const & playerInfo) {
if (result.isSuccess()) {
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
for(auto it = playerInfo.providerInfoData.begin(); it != playerInfo.providerInfoData.end(); ++it) {
hive::ProviderInfo providerInfo = it->second;
if(!providerInfo.providerEmail.empty()) {
std::string email = providerInfo.providerEmail;
break;
}
}
}
else if (result.needExit()) {
// TODO: Implement the termination of the app
// Users of the Cocos2d-x engine
// ex) exit(0);
// Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
});
API Reference: com.hive.AuthV4.showSignIn
// Request Hive SDK AuthV4 Authentication UI
AuthV4.showSignIn(object : AuthV4.AuthV4SignInListener{
override fun onAuthV4SignIn(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess) {
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
playerInfo?.let {
for ((key, value) in it.providerInfoData) {
var providerInfo: AuthV4.ProviderInfo = value
if(providerInfo.providerEmail.isNotEmpty()) {
val email = providerInfo.providerEmail
break
}
}
}
} else if (result.needExit()) {
// TODO: Implement the termination of the app
// ex) exitProcess(0)
}
}
})
API Reference: com.hive.AuthV4.showSignIn
// Request Hive SDK AuthV4 Authentication UI
AuthV4.showSignIn(new AuthV4.AuthV4SignInListener() {
@Override
public void onAuthV4SignIn(ResultAPI result, AuthV4.PlayerInfo playerInfo) {
if (result.isSuccess()) {
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
if(playerInfo != null) {
for (Map.Entry<AuthV4.ProviderType , AuthV4.ProviderInfo> entry : playerInfo.getProviderInfoData().entrySet()) {
AuthV4.ProviderInfo providerInfo = entry.getValue();
if (providerInfo.getProviderEmail() != "") {
String email = providerInfo.getProviderEmail();
break;
}
}
}
}
else if (result.needExit()) {
// TODO: Implement the termination of the app
// Example) System.exit(0);
}
}
});
API Reference: HIVEAuthV4:showSignIn
var email = String()
// Request Hive SDK AuthV4 Authentication UI
AuthV4Interface.showSignIn { (result, playerInfo) in
if result.isSuccess() {
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
if let playerInfo = playerInfo {
// find providerInfo that the providerEmail exists (the provider of the current sign-in)
for key in playerInfo.providerInfoData.keys {
if let providerInfo = playerInfo.providerInfoData[key],
providerInfo.providerEmail.count > 0 {
// providerEmail != ""
email = providerInfo.providerEmail
break
}
}
}
} else if result.needExit() {
// TODO: Implement the termination of the app
// Example) exit(0)
}
}
API Reference: HIVEAuthV4:showSignIn
__block NSString* email = @"";
// Request Hive SDK AuthV4 Authentication UI
[HIVEAuthV4 showSignIn:^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
if([result isSuccess]){
// authentication success
// playerInfo: Authenticated user information
// the example of getting email information
if(playerInfo != nil) {
// find providerInfo that the providerEmail exists (the provider of the current sign-in)
for (NSString* key in playerInfo.providerInfoData.allKeys) {
HIVEProviderInfo* providerInfo = playerInfo.providerInfoData[key];
if (providerInfo != nil && providerInfo.providerEmail.length > 0) {
// providerEmail != ""
email = providerInfo.providerEmail;
break;
}
}
}
} else if ([result needExit]) {
// TODO: Implement the termination of the app
// ex) exit(0);
}
}];
Note
게스트 로그인과 커스텀 로그인은 ProviderInfo애 이메일 정보가 없고 빈 문자열("")로 표시합니다.
유저 이메일 정보가 없는 경우 ProviderInfo 이메일 정보는 빈 문자열("")입니다.



