diff --git a/include/braincloud/AuthenticationType.h b/include/braincloud/AuthenticationType.h index 49475c1f..cf75e881 100644 --- a/include/braincloud/AuthenticationType.h +++ b/include/braincloud/AuthenticationType.h @@ -26,6 +26,7 @@ namespace BrainCloud static const AuthenticationType & GameCenter; static const AuthenticationType & Steam; static const AuthenticationType & Apple; + static const AuthenticationType & EpicGames; static const AuthenticationType & Google; static const AuthenticationType & GoogleOpenId; static const AuthenticationType & Twitter; diff --git a/include/braincloud/BrainCloudAppStore.h b/include/braincloud/BrainCloudAppStore.h index adeae755..38040743 100644 --- a/include/braincloud/BrainCloudAppStore.h +++ b/include/braincloud/BrainCloudAppStore.h @@ -34,6 +34,8 @@ namespace BrainCloud * - windows * - windowsPhone * - googlePlay + * - epicGames + * - xsolla * @param receiptData the specific store data required * @param callback The method to be invoked when the server response is received */ @@ -64,6 +66,8 @@ namespace BrainCloud * - windows * - windowsPhone * - googlePlay + * - epicGames + * - xsolla * @param userCurrency The currency type to retrieve the sales inventory for. * @param callback The method to be invoked when the server response is received */ @@ -84,6 +88,8 @@ namespace BrainCloud * - windows * - windowsPhone * - googlePlay + * - epicGames + * - xsolla * @param userCurrency The currency type to retrieve the sales inventory for. * @param category The product category * @param callback The method to be invoked when the server response is received @@ -96,14 +102,7 @@ namespace BrainCloud * Service Name - appStore * Service Operation - START_PURCHASE * - * @param storeId The store platform. Valid stores are: - * - itunes - * - facebook - * - appworld - * - steam - * - windows - * - windowsPhone - * - googlePlay + * @param storeId The store id. Currently only accepts "steam". * @param purchaseData specific data for purchasing 2 staged purchases * @param callback The method to be invoked when the server response is received */ @@ -115,14 +114,7 @@ namespace BrainCloud * Service Name - appStore * Service Operation - FINALIZE_PURCHASE * - * @param storeId The store platform. Valid stores are: - * - itunes - * - facebook - * - appworld - * - steam - * - windows - * - windowsPhone - * - googlePlay + * @param storeId The store id. Currently only accepts "steam". * @param transactionId the transactionId returned from start Purchase * @param transactionData specific data for purchasing 2 staged purchases * @param callback The method to be invoked when the server response is received @@ -154,6 +146,8 @@ namespace BrainCloud * - windows * - windowsPhone * - googlePlay + * - epicGames + * - xsolla * @param transactionId the transactionId returned from start Purchase * @param transactionData specific data for purchasing 2 staged purchases * @param callback The method to be invoked when the server response is received diff --git a/include/braincloud/BrainCloudAuthentication.h b/include/braincloud/BrainCloudAuthentication.h index 49e481e1..e4a951be 100644 --- a/include/braincloud/BrainCloudAuthentication.h +++ b/include/braincloud/BrainCloudAuthentication.h @@ -195,18 +195,31 @@ namespace BrainCloud void authenticateSteam(const char * userId, const char * sessionticket, bool forceCreate, IServerCallback * callback = NULL); /** - * Authenticate the user using a google userid(email address) and google authentication token. + * Authenticate the user using their Apple account and identityToken. * * Service Name - authenticationV2 * Service Operation - AUTHENTICATE * * @param appleUserId String of the apple accounts user Id OR email - * @param identityToken The authentication token confirming users identity + * @param identityToken The identityToken confirming users identity * @param forceCreate Should a new profile be created for this user if the account does not exist? * @param callback The method to be invoked when the server response is received */ void authenticateApple(const char * appleUserId, const char * identityToken, bool forceCreate, IServerCallback * callback = NULL); + /** + * Authenticate the user using an epicAccountId and their authIdToken. + * + * Service Name - authenticationV2 + * Service Operation - AUTHENTICATE + * + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param authIdToken IdToken string from the EOS AuthInterface's CopyIdToken method. + * @param forceCreate Should a new profile be created for this user if the account does not exist? + * @param callback The method to be invoked when the server response is received + */ + void authenticateEpicGames(const char * epicAccountId, const char * authIdToken, bool forceCreate, IServerCallback * callback = NULL); + /** * Authenticate the user using a google userid(email address) and google authentication token. * diff --git a/include/braincloud/BrainCloudIdentity.h b/include/braincloud/BrainCloudIdentity.h index 93b728b4..0539abea 100644 --- a/include/braincloud/BrainCloudIdentity.h +++ b/include/braincloud/BrainCloudIdentity.h @@ -294,6 +294,54 @@ namespace BrainCloud */ void detachAppleIdentity(const char * appleId, bool continueAnon, IServerCallback * callback = NULL); + /** + * Attach the user's EpicGames credentials to the current profile. + * + * Service Name - identity + * Service Operation - ATTACH + * + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param authIdToken IdToken string from the EOS AuthInterface's CopyIdToken method. + * @param callback The method to be invoked when the server response is received + * + * Errors to watch for: SWITCHING_PROFILES - this means that the EpicGames identity you provided + * already points to a different profile. You will likely want to offer the user the + * choice to *SWITCH* to that profile, or *MERGE* the profiles. + * + * To switch profiles, call ClearSavedProfileID() and call AuthenticateEpicGames(). + */ + void attachEpicGamesIdentity(const char * epicAccountId, const char * authIdToken, IServerCallback * callback = NULL); + + /** + * Merge the profile associated with the provided EpicGames credentials with the + * current profile. + * + * Service Name - identity + * Service Operation - MERGE + * + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param authIdToken IdToken string from the EOS AuthInterface's CopyIdToken method. + * @param callback The method to be invoked when the server response is received + * + */ + void mergeEpicGamesIdentity(const char * epicAccountId, const char * authIdToken, IServerCallback * callback = NULL); + + /** + * Detach the EpicGames identity from this profile. + * + * Service Name - identity + * Service Operation - DETACH + * + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param continueAnon Proceed even if the profile will revert to anonymous? + * @param callback The method to be invoked when the server response is received + * + * Watch for DOWNGRADING_TO_ANONYMOUS_ERROR - occurs if you set continueAnon to false, and + * disconnecting this identity would result in the profile being anonymous (which means that + * the profile wouldn't be retrievable if the user loses their device) + */ + void detachEpicGamesIdentity(const char * epicAccountId, bool continueAnon, IServerCallback * callback = NULL); + /** * Attach the user's Ultra credentials to the current profile. * diff --git a/include/braincloud/BrainCloudWrapper.h b/include/braincloud/BrainCloudWrapper.h index 4b1e50b1..59ae4a01 100644 --- a/include/braincloud/BrainCloudWrapper.h +++ b/include/braincloud/BrainCloudWrapper.h @@ -281,19 +281,19 @@ namespace BrainCloud { * @param gameCenterId The user's Game Center Id which can be the playerId, gamePlayerId, or teamPlayerId from the localPlayer object. * @param forceCreate Should a new profile be created for this user if the account does not exist? * @param timestamp The timestamp value returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param publicKeyUrl The publicKeyUrl value returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param signature The raw signature bytes returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param signatureLength The length of the returned identity verification signature. - * Required for modern Game Center verification. - * @param salt The raw salt bytes returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param saltLength The length of the returned identity verification salt. - * Required for modern Game Center verification. - * @param teamPlayerId Optional for Game Center verification; only required when gameCenterId is set to a value other than teamPlayerId (e.g. playerId), - * so that brainCloud can still associate the user with their team-scoped identity. + * Required for modern Game Center verification. + * @param publicKeyUrl The publicKeyUrl value returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param signature The raw signature bytes returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param signatureLength The length of the returned identity verification signature. + * Required for modern Game Center verification. + * @param salt The raw salt bytes returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param saltLength The length of the returned identity verification salt. + * Required for modern Game Center verification. + * @param teamPlayerId Optional for Game Center verification; only required when gameCenterId is set to a value other than teamPlayerId (e.g. playerId), + * so that brainCloud can still associate the user with their team-scoped identity. * @param callback The method to be invoked when the server response is received. * * @returns Performs the success callback on success, failure callback on failure. @@ -301,22 +301,38 @@ namespace BrainCloud { */ void authenticateGameCenter(const char* gameCenterId, bool forceCreate, uint64_t timestamp, const std::string& publicKeyUrl, const uint8_t* signature, size_t signatureLength, const uint8_t* salt, size_t saltLength, const std::string& teamPlayerId = "", IServerCallback* callback = NULL); - /** - * Authenticate the user using a google userid(email address) and google authentication token. - * - * Service Name - authenticationV2 - * Service Operation - AUTHENTICATE - * - * @param appleUserId String of the apple accounts user Id OR email - * @param identityToken The authentication token confirming users identity - * @param forceCreate Should a new profile be created for this user if the account does not exist? - * @param callback The method to be invoked when the server response is received + /** + * Authenticate the user using their Apple account and identityToken. + * + * Service Name - authenticationV2 + * Service Operation - AUTHENTICATE + * + * @param appleUserId String of the apple accounts user Id OR email + * @param identityToken The authentication token confirming users identity + * @param forceCreate Should a new profile be created for this user if the account does not exist? + * @param callback The method to be invoked when the server response is received * * @returns Performs the success callback on success, failure callback on failure. * - */ + */ void authenticateApple(const char * appleUserId, const char * identityToken, bool forceCreate, IServerCallback * callback = NULL); + /** + * Authenticate the user using an epicAccountId and their authIdToken. + * + * Service Name - authenticationV2 + * Service Operation - AUTHENTICATE + * + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param authIdToken IdToken string from the EOS AuthInterface's CopyIdToken method. + * @param forceCreate Should a new profile be created for this user if the account does not exist? + * @param callback The method to be invoked when the server response is received + * + * @returns Performs the success callback on success, failure callback on failure. + * + */ + void authenticateEpicGames(const char * epicAccountId, const char * authIdToken, bool forceCreate, IServerCallback * callback = NULL); + /** * Authenticate the user using a google userid(email address) and google authentication token. * @@ -436,8 +452,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user with a custom Email and Password. Note that the client app * is responsible for collecting (and storing) the e-mail and potentially password @@ -462,8 +478,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user via cloud code (which in turn validates the supplied credentials against an external system). * This allows the developer to extend brainCloud authentication to support other backend authentication systems. @@ -484,8 +500,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user with brainCloud using their Facebook Credentials * @@ -505,8 +521,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user with brainCloud using their FacebookLimited Credentials * @@ -526,8 +542,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user with brainCloud using their Oculus Credentials * @@ -546,8 +562,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using their Game Center Id (legacy support only, not recommended). * @@ -569,8 +585,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using their Game Center Id and identity verification signature. * @@ -580,19 +596,19 @@ namespace BrainCloud { * @param gameCenterId The user's Game Center Id which can be the playerId, gamePlayerId, or teamPlayerId from the localPlayer object. * @param forceCreate Should a new profile be created for this user if the account does not exist? * @param timestamp The timestamp value returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param publicKeyUrl The publicKeyUrl value returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param signature The raw signature bytes returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param signatureLength The length of the returned identity verification signature. - * Required for modern Game Center verification. - * @param salt The raw salt bytes returned as part of the identity verification signature fetch from Game Center. - * Required for modern Game Center verification. - * @param saltLength The length of the returned identity verification salt. - * Required for modern Game Center verification. - * @param teamPlayerId Optional for Game Center verification; only required when gameCenterId is set to a value other than teamPlayerId (e.g. playerId), - * so that brainCloud can still associate the user with their team-scoped identity. + * Required for modern Game Center verification. + * @param publicKeyUrl The publicKeyUrl value returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param signature The raw signature bytes returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param signatureLength The length of the returned identity verification signature. + * Required for modern Game Center verification. + * @param salt The raw salt bytes returned as part of the identity verification signature fetch from Game Center. + * Required for modern Game Center verification. + * @param saltLength The length of the returned identity verification salt. + * Required for modern Game Center verification. + * @param teamPlayerId Optional for Game Center verification; only required when gameCenterId is set to a value other than teamPlayerId (e.g. playerId), + * so that brainCloud can still associate the user with their team-scoped identity. * @param callback The method to be invoked when the server response is received. * * @returns Performs the success callback on success, failure callback on failure. @@ -602,8 +618,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using a google userid(email address) and google authentication token. * @@ -622,8 +638,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using a google userid(email address) and google authentication token. * @@ -642,28 +658,48 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * - * Authenticate the user using a google userid(email address) and google authentication token. + * Authenticate the user using their Apple account and identityToken. + * + * Service Name - authenticationV2 + * Service Operation - AUTHENTICATE + * + * @param appleUserId String of the apple accounts user Id OR email + * @param identityToken The identityToken confirming users identity + * @param forceCreate Should a new profile be created for this user if the account does not exist? + * @param callback The method to be invoked when the server response is received + * + * @returns Performs the success callback on success, failure callback on failure. + * + */ + void smartSwitchAuthenticateApple(const char* appleUserId, const char* identityToken, bool forceCreate, IServerCallback* callback = NULL); + + /** + * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles + * + * Authenticate the user using an epicAccountId and their authIdToken. * * Service Name - authenticationV2 * Service Operation - AUTHENTICATE * - * @param userid String representation of apple+ userid (email) - * @param token The authentication token derived via the apple apis. + * @param epicAccountId LocalUserId retrieved from the EOS AuthInterface's Login method. + * @param authIdToken IdToken string from the EOS AuthInterface's CopyIdToken method. * @param forceCreate Should a new profile be created for this user if the account does not exist? * @param callback The method to be invoked when the server response is received * * @returns Performs the success callback on success, failure callback on failure. * */ - void smartSwitchAuthenticateApple(const char* userid, const char* token, bool forceCreate, IServerCallback* callback = NULL); + void smartSwitchAuthenticateEpicGames(const char* epicAccountId, const char* authIdToken, bool forceCreate, IServerCallback* callback = NULL); /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using a steam userid and session ticket (without any validation on the userid). * @@ -682,8 +718,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using a Twitter userid, authentication token, and secret from Twitter. * @@ -703,8 +739,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user using a userid and password (without any validation on the userid). * Similar to AuthenticateEmailPassword - except that that method has additional features to @@ -725,8 +761,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * Authenticate the user for Ultra. * @@ -745,8 +781,8 @@ namespace BrainCloud { /** * Smart Switch Authenticate will logout of the current profile, and switch to the new authentication type. - * In event the current session was previously an anonymous account, the smart switch will delete that profile. - * Use this function to keep a clean designflow from anonymous to signed profiles + * In event the current session was previously an anonymous account, the smart switch will delete that profile. + * Use this function to keep a clean designflow from anonymous to signed profiles * * A generic Authenticate method that translates to the same as calling a specific one, except it takes an extraJson * that will be passed along to pre- or post- hooks. diff --git a/src/AuthenticationType.cpp b/src/AuthenticationType.cpp index c4d89771..c44cf42e 100644 --- a/src/AuthenticationType.cpp +++ b/src/AuthenticationType.cpp @@ -12,6 +12,7 @@ namespace BrainCloud const AuthenticationType & AuthenticationType::GameCenter = AuthenticationType("GameCenter"); const AuthenticationType & AuthenticationType::Steam = AuthenticationType("Steam"); const AuthenticationType & AuthenticationType::Apple = AuthenticationType("Apple"); + const AuthenticationType & AuthenticationType::EpicGames = AuthenticationType("EpicGames"); const AuthenticationType & AuthenticationType::Google = AuthenticationType("Google"); const AuthenticationType & AuthenticationType::GoogleOpenId = AuthenticationType("GoogleOpenId"); const AuthenticationType & AuthenticationType::Twitter = AuthenticationType("Twitter"); @@ -67,6 +68,10 @@ namespace BrainCloud { return AuthenticationType::Apple; } + if (AuthenticationType == EpicGames) + { + return AuthenticationType::EpicGames; + } if (AuthenticationType == Google) { return AuthenticationType::Google; diff --git a/src/BrainCloudAuthentication.cpp b/src/BrainCloudAuthentication.cpp index 4a4c5908..513f196b 100644 --- a/src/BrainCloudAuthentication.cpp +++ b/src/BrainCloudAuthentication.cpp @@ -148,6 +148,11 @@ namespace BrainCloud { authenticate(appleUserId, identityToken, AuthenticationType::Apple, NULL, forceCreate, "", callback); } + void BrainCloudAuthentication::authenticateEpicGames(const char * epicAccountId, const char * authIdToken, bool forceCreate, IServerCallback * callback) + { + authenticate(epicAccountId, authIdToken, AuthenticationType::EpicGames, NULL, forceCreate, "", callback); + } + void BrainCloudAuthentication::authenticateGoogle(const char * googleUserId, const char * serverAuthToken, bool forceCreate, IServerCallback * callback) { authenticate(googleUserId, serverAuthToken, AuthenticationType::Google, NULL, forceCreate, "", callback); diff --git a/src/BrainCloudIdentity.cpp b/src/BrainCloudIdentity.cpp index 6635a597..7ef412c0 100644 --- a/src/BrainCloudIdentity.cpp +++ b/src/BrainCloudIdentity.cpp @@ -135,6 +135,21 @@ namespace BrainCloud detachIdentity(appleId, AuthenticationType::Apple, continueAnon, callback); } + void BrainCloudIdentity::attachEpicGamesIdentity(const char * epicAccountId, const char * authIdToken, IServerCallback * callback) + { + attachIdentity(epicAccountId, authIdToken, AuthenticationType::EpicGames, callback); + } + + void BrainCloudIdentity::mergeEpicGamesIdentity(const char * epicAccountId, const char * authIdToken, IServerCallback * callback) + { + mergeIdentity(epicAccountId, authIdToken, AuthenticationType::EpicGames, callback); + } + + void BrainCloudIdentity::detachEpicGamesIdentity(const char * epicAccountId, bool continueAnon, IServerCallback * callback) + { + detachIdentity(epicAccountId, AuthenticationType::EpicGames, continueAnon, callback); + } + void BrainCloudIdentity::attachUltraIdentity(const std::string &ultraUsername, const std::string &ultraIdToken, IServerCallback * callback) { attachIdentity(ultraUsername.c_str(), ultraIdToken.c_str(), AuthenticationType::Ultra, callback); diff --git a/src/BrainCloudWrapper.cpp b/src/BrainCloudWrapper.cpp index 40d1e6bd..a1a32531 100644 --- a/src/BrainCloudWrapper.cpp +++ b/src/BrainCloudWrapper.cpp @@ -254,6 +254,15 @@ namespace BrainCloud { client->getAuthenticationService()->authenticateApple(appleUserId, identityToken, forceCreate, this); } + void BrainCloudWrapper::authenticateEpicGames(const char* epicAccountId, const char* authIdToken, bool forceCreate, IServerCallback* callback) + { + m_authenticateCallback = callback; + + initializeIdentity(); + + client->getAuthenticationService()->authenticateEpicGames(epicAccountId, authIdToken, forceCreate, this); + } + void BrainCloudWrapper::authenticateGoogle(const char* googleUserId, const char* serverAuthCode, bool forceCreate, IServerCallback* callback) { m_authenticateCallback = callback; @@ -640,28 +649,53 @@ namespace BrainCloud { getIdentitiesCallback(smartCallback); } - void BrainCloudWrapper::smartSwitchAuthenticateApple(const char* userid, const char* token, bool forceCreate, IServerCallback* callback) + void BrainCloudWrapper::smartSwitchAuthenticateApple(const char* appleUserId, const char* identityToken, bool forceCreate, IServerCallback* callback) { class SmartSwitchAuthenticateCallback : public SmartSwitchCallback { public: - SmartSwitchAuthenticateCallback(BrainCloudWrapper* wrapper, const char* userid, const char* token, bool forceCreate, IServerCallback* callback) : SmartSwitchCallback(wrapper, callback) { - this->userid = userid; - this->token = token; + SmartSwitchAuthenticateCallback(BrainCloudWrapper* wrapper, const char* appleUserId, const char* identityToken, bool forceCreate, IServerCallback* callback) : SmartSwitchCallback(wrapper, callback) { + this->appleUserId = appleUserId; + this->identityToken = identityToken; this->forceCreate = forceCreate; } - std::string userid; std::string token; bool forceCreate; + std::string appleUserId; std::string identityToken; bool forceCreate; void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, std::string const & jsonData) { wrapper->clearIds(); - wrapper->client->getAuthenticationService()->authenticateApple(userid.c_str(), token.c_str(), forceCreate, callback); + wrapper->client->getAuthenticationService()->authenticateApple(appleUserId.c_str(), identityToken.c_str(), forceCreate, callback); delete this; } }; - SmartSwitchAuthenticateCallback *smartCallback = new SmartSwitchAuthenticateCallback(this, userid, token, forceCreate, callback); + SmartSwitchAuthenticateCallback *smartCallback = new SmartSwitchAuthenticateCallback(this, appleUserId, identityToken, forceCreate, callback); + getIdentitiesCallback(smartCallback); + } + + void BrainCloudWrapper::smartSwitchAuthenticateEpicGames(const char* epicAccountId, const char* authIdToken, bool forceCreate, IServerCallback* callback) + { + class SmartSwitchAuthenticateCallback : public SmartSwitchCallback + { + public: + SmartSwitchAuthenticateCallback(BrainCloudWrapper* wrapper, const char* epicAccountId, const char* authIdToken, bool forceCreate, IServerCallback* callback) : SmartSwitchCallback(wrapper, callback) { + this->epicAccountId = epicAccountId; + this->authIdToken = authIdToken; + this->forceCreate = forceCreate; + } + + std::string epicAccountId; std::string authIdToken; bool forceCreate; + + void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, std::string const & jsonData) + { + wrapper->clearIds(); + wrapper->client->getAuthenticationService()->authenticateEpicGames(epicAccountId.c_str(), authIdToken.c_str(), forceCreate, callback); + delete this; + } + }; + + SmartSwitchAuthenticateCallback *smartCallback = new SmartSwitchAuthenticateCallback(this, epicAccountId, authIdToken, forceCreate, callback); getIdentitiesCallback(smartCallback); }