Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class AuthenticationType {
public static final AuthenticationType GameCenter = new AuthenticationType("GameCenter");
public static final AuthenticationType Steam = new AuthenticationType("Steam");
public static final AuthenticationType Apple = new AuthenticationType("Apple");
public static final AuthenticationType EpicGames = new AuthenticationType("EpicGames");
public static final AuthenticationType Google = new AuthenticationType("Google");
public static final AuthenticationType GoogleOpenId = new AuthenticationType("GoogleOpenId");
public static final AuthenticationType Twitter = new AuthenticationType("Twitter");
Expand Down Expand Up @@ -63,6 +64,9 @@ public static AuthenticationType fromString(String s) {
if (s.equals(Apple.toString())) {
return Apple;
}
if (s.equals(EpicGames.toString())) {
return EpicGames;
}
if (s.equals(Google.toString())) {
return Google;
}
Expand Down
68 changes: 55 additions & 13 deletions src/main/java/com/bitheads/braincloud/client/BrainCloudWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,25 +554,45 @@ public void authenticateGoogleOpenId(String googleOpenId,
}

/**
* Authenticate the user using an apple userid(email address) and apple
* authentication token.
* Authenticate the user using their Apple account and identityToken.
*
* @param appleUserId String representation of apple userid (email)
* @param token The authentication token derived via the apple apis.
* @param forceCreate Should a new profile be created for this user if the account
* does not exist?
* @param callback The callback handler
* @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 callback handler
*/
@Override
public void authenticateApple(String appleUserId,
String token,
boolean forceCreate,
IServerCallback callback) {
String identityToken,
boolean forceCreate,
IServerCallback callback) {
_authenticateCallback = callback;

initializeIdentity(false);

getClient().getAuthenticationService().authenticateApple(appleUserId, identityToken, forceCreate, this);
}

/**
* Authenticate the user using an epicAccountId and their authIdToken.
*
* @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 callback handler
*/
@Override
public void authenticateEpicGames(String epicAccountId,
String authIdToken,
boolean forceCreate,
IServerCallback callback) {
_authenticateCallback = callback;

initializeIdentity(false);

getClient().getAuthenticationService().authenticateApple(appleUserId, token, forceCreate, this);
getClient().getAuthenticationService().authenticateEpicGames(epicAccountId, authIdToken, forceCreate, this);
}

/**
Expand Down Expand Up @@ -1036,7 +1056,29 @@ public void serverError(ServiceName serviceName, ServiceOperation serviceOperati
}

@Override
public void smartSwitchAuthenticateApple(String appleUserId, String token, boolean forceCreate, IServerCallback callback)
public void smartSwitchAuthenticateApple(String appleUserId, String identityToken, boolean forceCreate, IServerCallback callback)
{
getIdentitiesCallback(new IServerCallback() {
@Override
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData) {

// Clear IDs
resetStoredAnonymousId();
resetStoredProfileId();
getClient().getAuthenticationService().clearSavedProfileId();

authenticateApple(appleUserId, identityToken, forceCreate, callback);
}

@Override
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError) {
callback.serverError(serviceName, serviceOperation, statusCode, reasonCode, jsonError);
}
});
}

@Override
public void smartSwitchAuthenticateEpicGames(String epicAccountId, String authIdToken, boolean forceCreate, IServerCallback callback)
{
getIdentitiesCallback(new IServerCallback() {
@Override
Expand All @@ -1047,7 +1089,7 @@ public void serverCallback(ServiceName serviceName, ServiceOperation serviceOper
resetStoredProfileId();
getClient().getAuthenticationService().clearSavedProfileId();

authenticateApple(appleUserId, token, forceCreate, callback);
authenticateEpicGames(epicAccountId, authIdToken, forceCreate, callback);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,26 @@ void authenticateGoogleOpenId(String googleOpenId, String googleAuthToken, boole
IServerCallback callback);

/**
* Authenticate the user using an apple userid(email address) and apple
* authentication token.
* Authenticate the user using their Apple account and identityToken.
*
* @param appleUserId String representation of apple userid (email)
* @param token The authentication token derived via the apple apis.
* @param forceCreate Should a new profile be created for this user if the account
* does not exist?
* @param callback The callback handler
* @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 callback handler
*/
void authenticateApple(String appleUserId, String token, boolean forceCreate, IServerCallback callback);
void authenticateApple(String appleUserId, String identityToken, boolean forceCreate, IServerCallback callback);

/**
* Authenticate the user using an epicAccountId and their authIdToken.
*
* @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 callback handler
*/
void authenticateEpicGames(String epicAccountId, String authIdToken, boolean forceCreate, IServerCallback callback);

/**
* Authenticate the user using a steam userid and session ticket (without
Expand Down Expand Up @@ -507,7 +517,9 @@ void smartSwitchAuthenticateGoogle(String googleUserId, String serverAuthCode, b
void smartSwitchAuthenticateGoogleOpenId(String googleUserAccountEmail, String IdToken, boolean forceCreate,
IServerCallback callback);

void smartSwitchAuthenticateApple(String appleUserId, String token, boolean forceCreate, IServerCallback callback);
void smartSwitchAuthenticateApple(String appleUserId, String identityToken, boolean forceCreate, IServerCallback callback);

void smartSwitchAuthenticateEpicGames(String epicAccountId, String authIdToken, boolean forceCreate, IServerCallback callback);

void smartSwitchAuthenticateSteam(String steamUserId, String sessionTicket, boolean forceCreate,
IServerCallback callback);
Expand Down
26 changes: 10 additions & 16 deletions src/main/java/com/bitheads/braincloud/services/AppStoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public AppStoreService(BrainCloudClient client) {
* - 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
*/
Expand Down Expand Up @@ -91,6 +93,8 @@ public void getEligiblePromotions(IServerCallback callback) {
* - 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
*/
Expand All @@ -113,6 +117,8 @@ public void getSalesInventory(String storeId, String userCurrency, IServerCallba
* - 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
Expand Down Expand Up @@ -143,14 +149,7 @@ public void getSalesInventoryByCategory(String storeId, String userCurrency, Str
* 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
*/
Expand All @@ -173,14 +172,7 @@ public void startPurchase(String storeId, String jsonPurchaseData, IServerCallba
* 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
Expand Down Expand Up @@ -218,6 +210,8 @@ public void finalizePurchase(String storeId, String transactionId, String jsonTr
* - 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ public void authenticateOculus(String oculusUserId, String oculusNonce, boolean
}

/**
* 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 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
*/
Expand All @@ -284,6 +284,22 @@ public void authenticateApple(String appleUserId, String identityToken, boolean
authenticate(appleUserId, identityToken, AuthenticationType.Apple, null, forceCreate, null, callback);
}

/**
* 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
*/
public void authenticateEpicGames(String epicAccountId, String authIdToken, boolean forceCreate,
IServerCallback callback) {
authenticate(epicAccountId, authIdToken, AuthenticationType.EpicGames, null, forceCreate, null, callback);
}

/**
* Authenticate the user using a google userid(email address) and google authentication token.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,59 @@ public void detachAppleIdentity(String appleId, boolean continueAnon, IServerCal
detachIdentity(appleId, AuthenticationType.Apple, continueAnon, callback);
}

/**
* 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().
*/
public void attachEpicGamesIdentity(String epicAccountId, String authIdToken, IServerCallback callback) {
attachIdentity(epicAccountId, authIdToken, AuthenticationType.EpicGames, callback);
}

/**
* 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
*/
public void mergeEpicGamesIdentity(String epicAccountId, String authIdToken, IServerCallback callback) {
mergeIdentity(epicAccountId, authIdToken, AuthenticationType.EpicGames, callback);
}

/**
* 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)
*/
public void detachEpicGamesIdentity(String epicAccountId, boolean continueAnon, IServerCallback callback) {
detachIdentity(epicAccountId, AuthenticationType.EpicGames, continueAnon, callback);
}

/**** EMAIL AND PASSWORD Methods ***/

/**
Expand Down