// Copyright Epic Games, Inc. All Rights Reserved. // This file is automatically generated. Changes to this file may be overwritten. namespace Epic.OnlineServices.Auth { public sealed partial class AuthInterface : Handle { public AuthInterface() { } public AuthInterface(System.IntPtr innerHandle) : base(innerHandle) { } /// /// The most recent version of the struct. /// public const int AccountfeaturerestrictedinfoApiLatest = 1; /// /// The most recent version of the API. /// public const int AddnotifyloginstatuschangedApiLatest = 1; /// /// The most recent version of the API. /// public const int CopyidtokenApiLatest = 1; /// /// The most recent version of the API. /// public const int CopyuserauthtokenApiLatest = 1; /// /// The most recent version of the struct. /// public const int CredentialsApiLatest = 3; /// /// The most recent version of the API. /// public const int DeletepersistentauthApiLatest = 2; /// /// The most recent version of the struct. /// public const int IdtokenApiLatest = 1; /// /// The most recent version of the API. /// public const int LinkaccountApiLatest = 1; /// /// The most recent version of the API. /// public const int LoginApiLatest = 2; /// /// The most recent version of the API. /// public const int LogoutApiLatest = 1; /// /// The most recent version of the struct. /// public const int PingrantinfoApiLatest = 2; /// /// The most recent version of the API. /// public const int QueryidtokenApiLatest = 1; /// /// The most recent version of the struct. /// public const int TokenApiLatest = 2; /// /// The most recent version of the API. /// public const int VerifyidtokenApiLatest = 1; /// /// The most recent version of the API. /// public const int VerifyuserauthApiLatest = 1; /// /// Register to receive login status updates. /// must call RemoveNotifyLoginStatusChanged to remove the notification /// /// structure containing the api version of AddNotifyLoginStatusChanged to use /// arbitrary data that is passed back to you in the callback /// a callback that is fired when the login status for a user changes /// /// handle representing the registered callback /// public ulong AddNotifyLoginStatusChanged(ref AddNotifyLoginStatusChangedOptions options, object clientData, OnLoginStatusChangedCallback notification) { AddNotifyLoginStatusChangedOptionsInternal optionsInternal = new AddNotifyLoginStatusChangedOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var notificationInternal = new OnLoginStatusChangedCallbackInternal(OnLoginStatusChangedCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, notification, notificationInternal); var funcResult = Bindings.EOS_Auth_AddNotifyLoginStatusChanged(InnerHandle, ref optionsInternal, clientDataAddress, notificationInternal); Helper.Dispose(ref optionsInternal); Helper.AssignNotificationIdToCallback(clientDataAddress, funcResult); return funcResult; } /// /// 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 directly after a successful user login. /// /// /// Structure containing the account ID for which to copy an ID token. /// An ID token for the given user, if it exists and is valid; use when finished. /// /// if the information is available and passed out in OutUserIdToken /// if you pass a null pointer for the out parameter /// if the Id token is not found or expired. /// public Result CopyIdToken(ref CopyIdTokenOptions options, out IdToken? outIdToken) { CopyIdTokenOptionsInternal optionsInternal = new CopyIdTokenOptionsInternal(); optionsInternal.Set(ref options); var outIdTokenAddress = System.IntPtr.Zero; var funcResult = Bindings.EOS_Auth_CopyIdToken(InnerHandle, ref optionsInternal, ref outIdTokenAddress); Helper.Dispose(ref optionsInternal); Helper.Get(outIdTokenAddress, out outIdToken); if (outIdToken != null) { Bindings.EOS_Auth_IdToken_Release(outIdTokenAddress); } return funcResult; } /// /// 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 API should be used instead. /// /// /// Structure containing the api version of CopyUserAuthToken to use /// The Epic Account ID of the user being queried /// The auth token for the given user, if it exists and is valid; use when finished /// /// if the information is available and passed out in OutUserAuthToken /// if you pass a null pointer for the out parameter /// if the auth token is not found or expired. /// public Result CopyUserAuthToken(ref CopyUserAuthTokenOptions options, EpicAccountId localUserId, out Token? outUserAuthToken) { CopyUserAuthTokenOptionsInternal optionsInternal = new CopyUserAuthTokenOptionsInternal(); optionsInternal.Set(ref options); var localUserIdInnerHandle = System.IntPtr.Zero; Helper.Set(localUserId, ref localUserIdInnerHandle); var outUserAuthTokenAddress = System.IntPtr.Zero; var funcResult = Bindings.EOS_Auth_CopyUserAuthToken(InnerHandle, ref optionsInternal, localUserIdInnerHandle, ref outUserAuthTokenAddress); Helper.Dispose(ref optionsInternal); Helper.Get(outUserAuthTokenAddress, out outUserAuthToken); if (outUserAuthToken != null) { Bindings.EOS_Auth_Token_Release(outUserAuthTokenAddress); } return funcResult; } /// /// 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. /// /// structure containing operation input parameters /// arbitrary data that is passed back to you in the CompletionDelegate /// a callback that is fired when the deletion operation completes, either successfully or in error public void DeletePersistentAuth(ref DeletePersistentAuthOptions options, object clientData, OnDeletePersistentAuthCallback completionDelegate) { DeletePersistentAuthOptionsInternal optionsInternal = new DeletePersistentAuthOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnDeletePersistentAuthCallbackInternal(OnDeletePersistentAuthCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_DeletePersistentAuth(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// Fetch an Epic Account ID that is logged in. /// /// An index into the list of logged in accounts. If the index is out of bounds, the returned Epic Account ID will be invalid. /// /// The Epic Account ID associated with the index passed /// public EpicAccountId GetLoggedInAccountByIndex(int index) { var funcResult = Bindings.EOS_Auth_GetLoggedInAccountByIndex(InnerHandle, index); EpicAccountId funcResultReturn; Helper.Get(funcResult, out funcResultReturn); return funcResultReturn; } /// /// Fetch the number of accounts that are logged in. /// /// /// the number of accounts logged in. /// public int GetLoggedInAccountsCount() { var funcResult = Bindings.EOS_Auth_GetLoggedInAccountsCount(InnerHandle); return funcResult; } /// /// Fetches the login status for an Epic Account ID. /// /// The Epic Account ID of the user being queried /// /// The enum value of a user's login status /// public LoginStatus GetLoginStatus(EpicAccountId localUserId) { var localUserIdInnerHandle = System.IntPtr.Zero; Helper.Set(localUserId, ref localUserIdInnerHandle); var funcResult = Bindings.EOS_Auth_GetLoginStatus(InnerHandle, localUserIdInnerHandle); return funcResult; } /// /// Fetch one of the merged account IDs for a given logged in account. /// /// The account ID of a currently logged in account. /// An index into the list of merged accounts. If the index is out of bounds, the returned Epic Account ID will be invalid. /// /// The Epic Account ID associated with the index passed. /// public EpicAccountId GetMergedAccountByIndex(EpicAccountId localUserId, uint index) { var localUserIdInnerHandle = System.IntPtr.Zero; Helper.Set(localUserId, ref localUserIdInnerHandle); var funcResult = Bindings.EOS_Auth_GetMergedAccountByIndex(InnerHandle, localUserIdInnerHandle, index); EpicAccountId funcResultReturn; Helper.Get(funcResult, out funcResultReturn); return funcResultReturn; } /// /// Fetch the number of merged accounts for a given logged in account. /// /// The account ID of a currently logged in account. /// /// the number of merged accounts for the logged in account. /// public uint GetMergedAccountsCount(EpicAccountId localUserId) { var localUserIdInnerHandle = System.IntPtr.Zero; Helper.Set(localUserId, ref localUserIdInnerHandle); var funcResult = Bindings.EOS_Auth_GetMergedAccountsCount(InnerHandle, localUserIdInnerHandle); return funcResult; } /// /// Fetch the selected account ID to the current application for a local authenticated user. /// /// The account ID of a currently logged in account. /// The selected account ID corresponding to the given account ID. /// /// if the user is logged in and the information is available. /// if the output parameter is . /// if the input account ID is not locally known. /// if the input account ID is not locally logged in. /// otherwise. /// public Result GetSelectedAccountId(EpicAccountId localUserId, out EpicAccountId outSelectedAccountId) { var localUserIdInnerHandle = System.IntPtr.Zero; Helper.Set(localUserId, ref localUserIdInnerHandle); var outSelectedAccountIdAddress = System.IntPtr.Zero; var funcResult = Bindings.EOS_Auth_GetSelectedAccountId(InnerHandle, localUserIdInnerHandle, ref outSelectedAccountIdAddress); Helper.Get(outSelectedAccountIdAddress, out outSelectedAccountId); return funcResult; } /// /// Link external account by continuing previous login attempt with a continuance token. /// /// On Desktop and Mobile platforms, the user will be presented the Epic Account Portal to resolve their identity. /// /// On Console, the user will login to their Epic Account using an external device, e.g. a mobile device or a desktop PC, /// by browsing to the presented authentication URL and entering the device code presented by the game on the console. /// /// 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. /// /// structure containing the account credentials to use during the link account operation /// arbitrary data that is passed back to you in the CompletionDelegate /// a callback that is fired when the link account operation completes, either successfully or in error public void LinkAccount(ref LinkAccountOptions options, object clientData, OnLinkAccountCallback completionDelegate) { LinkAccountOptionsInternal optionsInternal = new LinkAccountOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnLinkAccountCallbackInternal(OnLinkAccountCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_LinkAccount(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// Login/Authenticate with user credentials. /// /// structure containing the account credentials to use during the login operation /// arbitrary data that is passed back to you in the CompletionDelegate /// a callback that is fired when the login operation completes, either successfully or in error public void Login(ref LoginOptions options, object clientData, OnLoginCallback completionDelegate) { LoginOptionsInternal optionsInternal = new LoginOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnLoginCallbackInternal(OnLoginCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_Login(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// Signs the player out of the online service. /// /// structure containing information about which account to log out. /// arbitrary data that is passed back to you in the CompletionDelegate /// a callback that is fired when the logout operation completes, either successfully or in error public void Logout(ref LogoutOptions options, object clientData, OnLogoutCallback completionDelegate) { LogoutOptionsInternal optionsInternal = new LogoutOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnLogoutCallbackInternal(OnLogoutCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_Logout(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// 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. /// /// Structure containing the merged account ID for which to query an ID token. /// Arbitrary data that is passed back to you in the CompletionDelegate. /// A callback that is fired when the operation completes, either successfully or in error. public void QueryIdToken(ref QueryIdTokenOptions options, object clientData, OnQueryIdTokenCallback completionDelegate) { QueryIdTokenOptionsInternal optionsInternal = new QueryIdTokenOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnQueryIdTokenCallbackInternal(OnQueryIdTokenCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_QueryIdToken(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// Unregister from receiving login status updates. /// /// handle representing the registered callback public void RemoveNotifyLoginStatusChanged(ulong inId) { Bindings.EOS_Auth_RemoveNotifyLoginStatusChanged(InnerHandle, inId); Helper.RemoveCallbackByNotificationId(inId); } /// /// Verify a given ID token for authenticity and validity. /// /// Structure containing information about the ID token to verify. /// Arbitrary data that is passed back to you in the CompletionDelegate /// A callback that is fired when the operation completes, either successfully or in error. public void VerifyIdToken(ref VerifyIdTokenOptions options, object clientData, OnVerifyIdTokenCallback completionDelegate) { VerifyIdTokenOptionsInternal optionsInternal = new VerifyIdTokenOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnVerifyIdTokenCallbackInternal(OnVerifyIdTokenCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_VerifyIdToken(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } /// /// Contact the backend service to verify validity of an existing user auth token. /// This function is intended for server-side use only. /// /// /// structure containing information about the auth token being verified /// arbitrary data that is passed back to you in the CompletionDelegate /// a callback that is fired when the logout operation completes, either successfully or in error public void VerifyUserAuth(ref VerifyUserAuthOptions options, object clientData, OnVerifyUserAuthCallback completionDelegate) { VerifyUserAuthOptionsInternal optionsInternal = new VerifyUserAuthOptionsInternal(); optionsInternal.Set(ref options); var clientDataAddress = System.IntPtr.Zero; var completionDelegateInternal = new OnVerifyUserAuthCallbackInternal(OnVerifyUserAuthCallbackInternalImplementation); Helper.AddCallback(out clientDataAddress, clientData, completionDelegate, completionDelegateInternal); Bindings.EOS_Auth_VerifyUserAuth(InnerHandle, ref optionsInternal, clientDataAddress, completionDelegateInternal); Helper.Dispose(ref optionsInternal); } [MonoPInvokeCallback(typeof(OnDeletePersistentAuthCallbackInternal))] internal static void OnDeletePersistentAuthCallbackInternalImplementation(ref DeletePersistentAuthCallbackInfoInternal data) { OnDeletePersistentAuthCallback callback; DeletePersistentAuthCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnLinkAccountCallbackInternal))] internal static void OnLinkAccountCallbackInternalImplementation(ref LinkAccountCallbackInfoInternal data) { OnLinkAccountCallback callback; LinkAccountCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnLoginCallbackInternal))] internal static void OnLoginCallbackInternalImplementation(ref LoginCallbackInfoInternal data) { OnLoginCallback callback; LoginCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnLoginStatusChangedCallbackInternal))] internal static void OnLoginStatusChangedCallbackInternalImplementation(ref LoginStatusChangedCallbackInfoInternal data) { OnLoginStatusChangedCallback callback; LoginStatusChangedCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnLogoutCallbackInternal))] internal static void OnLogoutCallbackInternalImplementation(ref LogoutCallbackInfoInternal data) { OnLogoutCallback callback; LogoutCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnQueryIdTokenCallbackInternal))] internal static void OnQueryIdTokenCallbackInternalImplementation(ref QueryIdTokenCallbackInfoInternal data) { OnQueryIdTokenCallback callback; QueryIdTokenCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnVerifyIdTokenCallbackInternal))] internal static void OnVerifyIdTokenCallbackInternalImplementation(ref VerifyIdTokenCallbackInfoInternal data) { OnVerifyIdTokenCallback callback; VerifyIdTokenCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } [MonoPInvokeCallback(typeof(OnVerifyUserAuthCallbackInternal))] internal static void OnVerifyUserAuthCallbackInternalImplementation(ref VerifyUserAuthCallbackInfoInternal data) { OnVerifyUserAuthCallback callback; VerifyUserAuthCallbackInfo callbackInfo; if (Helper.TryGetAndRemoveCallback(ref data, out callback, out callbackInfo)) { callback(ref callbackInfo); } } } }