using System; using System.Threading.Tasks; namespace Unity.Services.Authentication { /// /// The functions for Authentication service. /// public interface IAuthenticationService { /// /// Whether the player is signed in or not. /// bool IsSignedIn { get; } /// /// Returns the access token if the current player is signed in, otherwise null. /// string AccessToken { get; } /// /// Returns the player's ID if the current player is signed in, otherwise null. /// string PlayerId { get; } /// /// Invoked when a sign-in attempt has completed successfully. /// event Action SignedIn; /// /// Invoked when a sign-out attempt has completed successfully. /// event Action SignedOut; /// /// Invoked when a sign-in attempt has failed, giving the error as the /// parameter. /// event Action SignInFailed; /// /// Sign the player in anonymously. No credentials are required and the session is confined to the current device. /// /// /// If player has already signed in previously with a session token stored on the device, it signs the player back in no matter whether it's an anonymous player or not. /// /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInAnonymouslyAsync(); /// /// Sign the player in with the session token stored on the device. /// /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInWithSessionTokenAsync(); /// /// Sign in using Apple's ID token. /// /// Apple's ID token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInWithAppleAsync(string idToken); /// /// Link the current player with Apple account using Apple's ID token. /// /// Apple's ID token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task LinkWithAppleAsync(string idToken); /// /// Sign in using Google's ID token. /// /// Google's ID token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInWithGoogleAsync(string idToken); /// /// Link the current player with Google account using Google's ID token. /// /// Google's ID token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task LinkWithGoogleAsync(string idToken); /// /// Sign in using Facebook's access token. /// /// Facebook's access token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInWithFacebookAsync(string accessToken); /// /// Link the current player with Facebook account using Facebook's access token. /// /// Facebook's access token /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task LinkWithFacebookAsync(string accessToken); /// /// Sign in using Steam's session ticket. /// /// Steam's session ticket /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task SignInWithSteamAsync(string sessionTicket); /// /// Link the current player with Steam account using Steam's session ticket. /// /// Steam's session ticket /// Task for the async operation /// An exception containing the message and ErrorCode of the error. Refer to for error codes. Task LinkWithSteamAsync(string sessionTicket); /// /// Sign the current player out. /// /// An exception containing the message and ErrorCode of the error. Refer to for error codes. void SignOut(); /// /// The function to call when application is unpaused. /// It triggers and access token refresh if needed. /// void ApplicationUnpaused(); } }