Class AuthenticationService

java.lang.Object
com.bitheads.braincloud.services.AuthenticationService

public class AuthenticationService
extends Object
  • Constructor Details

    • AuthenticationService

      public AuthenticationService​(BrainCloudClient client)
  • Method Details

    • getAnonymousId

      public String getAnonymousId()
    • setAnonymousId

      public void setAnonymousId​(String anonymousId)
    • getProfileId

      public String getProfileId()
    • setProfileId

      public void setProfileId​(String profileId)
    • retryPreviousAuthenticate

      public void retryPreviousAuthenticate​(IServerCallback callback)
    • initialize

      public void initialize​(String profileId, String anonymousId)
      Initialize - initializes the identity service with a saved anonymous installation ID and most recently used profile ID
      Parameters:
      anonymousId - The anonymous installation id that was generated for this device
      profileId - The id of the profile id that was most recently used by the app (on this device)
    • clearSavedProfileId

      public void clearSavedProfileId()
      Used to clear the saved profile id - to use in cases when the user is attempting to switch to a different game profile.
    • generateAnonymousId

      public String generateAnonymousId()
      Used to create the anonymous installation id for the brainCloud profile.
      Returns:
      A unique Anonymous ID
    • authenticateAnonymous

      public void authenticateAnonymous​(boolean forceCreate, IServerCallback callback)
      Authenticate a user anonymously with brainCloud - used for apps that don't want to bother the user to login, or for users who are sensitive to their privacy
      Parameters:
      forceCreate - Should a new profile be created if it does not exist?
      callback - The callback handler
    • authenticateAnonymous

      public void authenticateAnonymous​(String anonymousId, boolean forceCreate, IServerCallback callback)
      Overloaded for users not using wrapper, they will need to create their own anonId. Authenticate a user anonymously with brainCloud - used for apps that don't want to bother the user to login, or for users who are sensitive to their privacy.
      Parameters:
      anonymousId - The anonymous id of the user
      forceCreate - Should a new profile be created if it does not exist?
      callback - The callback handler
    • authenticateEmailPassword

      public void authenticateEmailPassword​(String email, String password, boolean forceCreate, IServerCallback callback)
      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 (for convenience) in the client data. For the greatest security, force the user to re-enter their password at each login. (Or at least give them that option). Note that the password sent from the client to the server is protected via SSL.
      Parameters:
      email - The e-mail address of the user
      password - The password of the user
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateExternal

      public void authenticateExternal​(String userId, String token, String externalAuthName, boolean forceCreate, IServerCallback callback)
      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. Service Name - Authenticate Server Operation - Authenticate
      Parameters:
      userId - The user id
      token - The user token (password etc)
      externalAuthName - The name of the cloud script to call for external authentication
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateFacebook

      public void authenticateFacebook​(String fbUserId, String fbAuthToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user with brainCloud using their Facebook Credentials
      Parameters:
      fbUserId - The facebook id of the user
      fbAuthToken - The validated token from the Facebook SDK (that will be further validated when sent to the bC service)
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateFacebookLimited

      public void authenticateFacebookLimited​(String fbLimitedUserId, String fbAuthToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user with brainCloud using their FacebookLimited Credentials
      Parameters:
      fbLimitedUserId - The facebookLimited id of the user
      fbAuthToken - The validated token from the Facebook SDK (that will be further validated when sent to the bC service)
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateOculus

      public void authenticateOculus​(String oculusUserId, String oculusNonce, boolean forceCreate, IServerCallback callback)
      Authenticate the user with brainCloud using their Oculus Credentials
      Parameters:
      oculusUserId - The oculus id of the user
      oculusNonce - Validation token from oculus gotten through the oculus sdk
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateApple

      public void authenticateApple​(String appleUserId, String identityToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user using an apple id
      Parameters:
      appleUserId - This can be the user id OR the email of the user for the account
      identityToken - The token confirming the user's identity
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateGoogle

      public void authenticateGoogle​(String googleUserId, String serverAuthCode, boolean forceCreate, IServerCallback callback)
      Authenticate the user using a google userid(email address) and google authentication token.
      Parameters:
      googleUserId - String representation of google+ userId. Gotten with calls like RequestUserId
      serverAuthCode - The server authentication token derived via the google apis. Gotten with calls like RequestServerAuthCode
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateGoogleOpenId

      public void authenticateGoogleOpenId​(String googleUserAccountEmail, String IdToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user using a google userid(email address) and google openid token.
      Parameters:
      googleUserAccountEmail - The email associated with the google user
      IdToken - The id token of the google account. Can get with calls like requestIdToken
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateSteam

      public void authenticateSteam​(String steamUserId, String steamSessionTicket, boolean forceCreate, IServerCallback callback)
      Authenticate the user using a steam userid and session ticket (without any validation on the userid).
      Parameters:
      steamUserId - String representation of 64 bit steam id
      steamSessionTicket - The session ticket of the user (hex encoded)
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateUltra

      public void authenticateUltra​(String ultraUsername, String ultraIdToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user for Ultra.
      Parameters:
      ultraUsername - it's what the user uses to log into the Ultra endpoint initially
      ultraIdToken - The "id_token" taken from Ultra's JWT.
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateTwitter

      public void authenticateTwitter​(String userId, String token, String secret, boolean forceCreate, IServerCallback callback)
      Authenticate the user using a Twitter userid, authentication token, and secret from Twitter. Service Name - Authenticate Service Operation - Authenticate
      Parameters:
      userId - String representation of Twitter userid
      token - The authentication token derived via the Twitter apis.
      secret - The secret given when attempting to link with Twitter
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateUniversal

      public void authenticateUniversal​(String userId, String userPassword, boolean forceCreate, IServerCallback callback)
      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 allow for e-mail validation, password resets, etc.
      Parameters:
      userId - The id of the user
      userPassword - The password of the user
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateAdvanced

      public void authenticateAdvanced​(AuthenticationType authenticationType, AuthenticationIds ids, boolean forceCreate, String extraJson, IServerCallback callback)
    • authenticateParse

      public void authenticateParse​(String userId, String authenticationToken, boolean forceCreate, IServerCallback callback)
      Authenticate the user using a Parse user ID authentication token.
      Parameters:
      userId - String representation of Parse user ID
      authenticationToken - The authentication token derived via the google apis.
      forceCreate - Should a new profile be created for this user if the account does not exist?
      callback - The callback handler
    • authenticateHandoff

      public void authenticateHandoff​(String handoffId, String securityToken, IServerCallback callback)
      Authenticate the user using a handoffId and an authentication token.
      Parameters:
      handoffId - braincloud handoffId generated frim cloud script
      securityToken - The authentication token
      callback - The callback handler
    • authenticateSettopHandoff

      public void authenticateSettopHandoff​(String handoffCode, IServerCallback callback)
      Authenticate the user using a handoffId and an authentication token.
      Parameters:
      handoffCode - generate in cloud code
      callback - The callback handler
    • resetEmailPassword

      public void resetEmailPassword​(String email, IServerCallback callback)
      Reset Email password - Sends a password reset email to the specified address
      Parameters:
      email - The email address to send the reset email to.
      callback - The callback handler Note the follow error reason codes: SECURITY_ERROR (40209) - If the email address cannot be found.
    • resetEmailPasswordAdvanced

      public void resetEmailPasswordAdvanced​(String email, String serviceParams, IServerCallback callback)
      Reset Email password with service parameters - sends a password reset email to the specified address
      Parameters:
      email - the email address to send the reset email to
      serviceParams - parameters to send to the email service. see documentation for full list. http://getbraincloud.com/apidocs/apiref/#capi-mail
      callback - The callback handler Note the follow error reason codes: SECURITY_ERROR (40209) - If the email address cannot be found.
    • resetEmailPasswordWithExpiry

      public void resetEmailPasswordWithExpiry​(String email, int tokenTtlInMinutes, IServerCallback callback)
      Reset Email password with expiry - Sends a password reset email to the specified address
      Parameters:
      email - The email address to send the reset email to.
      tokenTtlInMinutes - , expiry token in mins
      callback - The callback handler Note the follow error reason codes: SECURITY_ERROR (40209) - If the email address cannot be found.
    • resetEmailPasswordAdvancedWithExpiry

      public void resetEmailPasswordAdvancedWithExpiry​(String email, String serviceParams, int tokenTtlInMinutes, IServerCallback callback)
      Reset Email password with service parameters and expiry token - sends a password reset email to the specified address
      Parameters:
      email - the email address to send the reset email to
      serviceParams - parameters to send to the email service. see documentation for full list. http://getbraincloud.com/apidocs/apiref/#capi-mail
      tokenTtlInMinutes - , expiry token in mins
      callback - The callback handler Note the follow error reason codes: SECURITY_ERROR (40209) - If the email address cannot be found.
    • resetUniversalIdPassword

      public void resetUniversalIdPassword​(String universalId, IServerCallback callback)
      Reset password of universalId
      Parameters:
      universalId - The users universalId
      callback - The callback handler
    • resetUniversalIdPasswordAdvanced

      public void resetUniversalIdPasswordAdvanced​(String universalId, String serviceParams, IServerCallback callback)
      Reset universal Ids password of universalId with template options
      Parameters:
      universalId - the email address to send the reset email to
      serviceParams - parameters to send to the service. see documentation for full list. http://getbraincloud.com/apidocs/apiref/#capi-mail
      callback - The callback handler
    • resetUniversalIdPasswordWithExpiry

      public void resetUniversalIdPasswordWithExpiry​(String universalId, int tokenTtlInMinutes, IServerCallback callback)
      Reset password of universalId with expiry token
      Parameters:
      universalId - The users universalId
      tokenTtlInMinutes - , expiry token in mins
      callback - The callback handler
    • resetUniversalIdPasswordAdvancedWithExpiry

      public void resetUniversalIdPasswordAdvancedWithExpiry​(String universalId, String serviceParams, int tokenTtlInMinutes, IServerCallback callback)
      Reset universal Ids password of universalId with template options with expiry token
      Parameters:
      universalId - the email address to send the reset email to
      serviceParams - parameters to send to the service. see documentation for full list. http://getbraincloud.com/apidocs/apiref/#capi-mail
      tokenTtlInMinutes - , expiry token in mins
      callback - The callback handler