Class EOS_Auth_Interface

java.lang.Object
com.sun.jna.PointerType
host.anzo.eossdk.eos.sdk.EOS_Auth_Interface
All Implemented Interfaces:
com.sun.jna.NativeMapped

public class EOS_Auth_Interface extends com.sun.jna.PointerType
The Auth Interface is used to manage local user permissions and access to backend services through the verification of various forms of credentials. All Auth Interface calls take a handle of type EOS_HAuth as the first parameter. This handle can be retrieved from an EOS_HPlatform handle by using the EOS_Platform_GetAuthInterface function.
Since:
8/9/2023
See Also:
  • Constructor Details

    • EOS_Auth_Interface

      public EOS_Auth_Interface(com.sun.jna.Pointer address)
    • EOS_Auth_Interface

      public EOS_Auth_Interface()
  • Method Details

    • login

      public void login(EOS_Auth_LoginOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnLoginCallback completionDelegate)
      Login/Authenticate with user credentials.
      Parameters:
      options - structure containing the account credentials to use during the login operation
      clientData - arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - a callback that is fired when the login operation completes, either successfully or in error
    • logout

      public void logout(EOS_Auth_LogoutOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnLogoutCallback completionDelegate)
      Signs the player out of the online service.
      Parameters:
      options - structure containing information about which account to log out.
      clientData - arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - a callback that is fired when the logout operation completes, either successfully or in error
    • linkAccount

      public void linkAccount(EOS_Auth_LinkAccountOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnLinkAccountCallback completionDelegate)
      Link external account by continuing previous login attempt with a continuance token.

      The user will be presented with Epic Accounts onboarding flow managed by the SDK.

      On success, the user will be logged in at the completion of this action. This will commit this external account to the Epic Account and cannot be undone in the SDK.

      Parameters:
      options - structure containing the account credentials to use during the link account operation
      clientData - arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - a callback that is fired when the link account operation completes, either successfully or in error
    • deletePersistentAuth

      public void deletePersistentAuth(EOS_Auth_DeletePersistentAuthOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnDeletePersistentAuthCallback completionDelegate)
      Deletes a previously received and locally stored persistent auth access token for the currently logged in user of the local device.

      On Desktop and Mobile platforms, the access token is deleted from the keychain of the local user and a backend request is made to revoke the token on the authentication server. On Console platforms, even though the caller is responsible for storing and deleting the access token on the local device, this function should still be called with the access token before its deletion to make the best effort in attempting to also revoke it on the authentication server. If the function would fail on Console, the caller should still proceed as normal to delete the access token locally as intended.

      Parameters:
      options - structure containing operation input parameters
      clientData - arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - a callback that is fired when the deletion operation completes, either successfully or in error
    • verifyUserAuth

      public void verifyUserAuth(EOS_Auth_VerifyUserAuthOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnVerifyUserAuthCallback completionDelegate)
      Contact the backend service to verify validity of an existing user auth token. This function is intended for server-side use only.
      Parameters:
      options - structure containing information about the auth token being verified
      clientData - arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - a callback that is fired when the logout operation completes, either successfully or in error
      See Also:
    • getLoggedInAccountsCount

      public int getLoggedInAccountsCount()
      Fetch the number of accounts that are logged in.
      Returns:
      the number of accounts logged in.
    • getLoggedInAccountByIndex

      public EOS_EpicAccountId getLoggedInAccountByIndex(int index)
      Fetch an Epic Account ID that is logged in.
      Parameters:
      index - An index into the list of logged in accounts. If the index is out of bounds, the returned Epic Account ID will be invalid.
      Returns:
      The Epic Account ID associated with the index passed
    • getLoginStatus

      public EOS_ELoginStatus getLoginStatus(EOS_EpicAccountId localUserId)
      Fetches the login status for an Epic Account ID.
      Parameters:
      localUserId - The Epic Account ID of the user being queried
      Returns:
      The enum value of a user's login status
    • copyUserAuthToken

      public EOS_Auth_Token copyUserAuthToken(EOS_Auth_CopyUserAuthTokenOptions options, EOS_EpicAccountId localUserId) throws EOSException
      Fetch a user auth token for an Epic Account ID.

      A user authentication token allows any code with possession (backend/client) to perform certain actions on behalf of the user. Because of this, for the purposes of user identity verification, the EOS_Auth_CopyIdToken API should be used instead.

      Parameters:
      options - Structure containing the api version of CopyUserAuthToken to use
      localUserId - The Epic Account ID of the user being queried
      Returns:
      The auth token for the given user, if it exists and is valid; use EOS_Auth_Token_Release when finished
      Throws:
      EOSInvalidParametersException - if you pass a null pointer for the out parameter
      EOSNotFoundException - if the auth token is not found or expired.
      EOSException
      See Also:
    • copyIdToken

      public EOS_Auth_IdToken copyIdToken(EOS_EpicAccountId accountId) throws EOSException
      Fetch an ID token for an Epic Account ID.

      ID tokens are used to securely verify user identities with online services. The most common use case is using an ID token to authenticate the local user by their selected account ID, which is the account ID that should be used to access any game-scoped data for the current application.

      An ID token for the selected account ID of a locally authenticated user will always be readily available. To retrieve it for the selected account ID, you can use EOS_Auth_CopyIdToken directly after a successful user login.

      Parameters:
      accountId - the account ID for which to copy an ID token.
      Returns:
      An ID token for the given user, if it exists and is valid; use EOS_Auth_IdToken_Release when finished.
      Throws:
      EOSInvalidParametersException - if you pass a null pointer for the out parameter
      EOSNotFoundException - if the Id token is not found or expired.
      EOSException
      See Also:
    • queryIdToken

      public void queryIdToken(EOS_Auth_QueryIdTokenOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnQueryIdTokenCallback completionDelegate)
      Query the backend for an ID token that describes one of the merged account IDs of a local authenticated user.

      The ID token can be used to impersonate a merged account ID when communicating with online services.

      An ID token for the selected account ID of a locally authenticated user will always be readily available and does not need to be queried explicitly.

      Parameters:
      options - Structure containing the merged account ID for which to query an ID token.
      clientData - Arbitrary data that is passed back to you in the CompletionDelegate.
      completionDelegate - A callback that is fired when the operation completes, either successfully or in error.
    • verifyIdToken

      public void verifyIdToken(EOS_Auth_VerifyIdTokenOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnVerifyIdTokenCallback completionDelegate)
      Verify a given ID token for authenticity and validity.
      Parameters:
      options - Structure containing information about the ID token to verify.
      clientData - Arbitrary data that is passed back to you in the CompletionDelegate
      completionDelegate - A callback that is fired when the operation completes, either successfully or in error.
    • getSelectedAccountId

      public EOS_EpicAccountId getSelectedAccountId(EOS_EpicAccountId localUserId) throws EOSException
      Fetch the selected account ID to the current application for a local authenticated user.
      Parameters:
      localUserId - The account ID of a currently logged in account.
      Returns:
      The selected account ID corresponding to the given account ID if the user is logged in and the information is available.
      Throws:
      EOSInvalidParametersException - if the output parameter is NULL.
      EOSInvalidUserException - if the input account ID is not locally known.
      EOSInvalidAuthException - if the input account ID is not locally logged in.
      EOSNotFoundException - otherwise.
      EOSException
    • getMergedAccountsCount

      public int getMergedAccountsCount(EOS_EpicAccountId localUserId)
      Fetch the number of merged accounts for a given logged in account.
      Parameters:
      localUserId - The account ID of a currently logged in account.
      Returns:
      the number of merged accounts for the logged in account.
    • getMergedAccountByIndex

      public EOS_EpicAccountId getMergedAccountByIndex(EOS_EpicAccountId localUserId, int index)
      Fetch one of the merged account IDs for a given logged in account.
      Parameters:
      localUserId - The account ID of a currently logged in account.
      index - An index into the list of merged accounts. If the index is out of bounds, the returned Epic Account ID will be invalid.
      Returns:
      The Epic Account ID associated with the index passed.
    • addNotifyLoginStatusChanged

      public EOS_NotificationId addNotifyLoginStatusChanged(EOS_Auth_AddNotifyLoginStatusChangedOptions options, com.sun.jna.Pointer clientData, EOS_Auth_OnLoginStatusChangedCallback notification)
      Register to receive login status updates.
      Must call removeNotifyLoginStatusChanged(EOS_NotificationId) to remove the notification
      Parameters:
      options - structure containing the api version of AddNotifyLoginStatusChanged to use
      clientData - arbitrary data that is passed back to you in the callback
      notification - a callback that is fired when the login status for a user changes
      Returns:
      handle representing the registered callback
    • removeNotifyLoginStatusChanged

      public void removeNotifyLoginStatusChanged(EOS_NotificationId inId)
      Unregister from receiving login status updates.
      Parameters:
      inId - handle representing the registered callback