public override void Awake()
 {
     base.Awake();
     Debug.Log("[HMS]: AWAKE AUTHSERVICE");
     authService = DefaultAuthService;
     //authServiceDrive = DefaultDriveAuthService;
 }
 public AccountController(
     AppUserManager userManager,
     SignInManager <ApplicationUser> signInManager,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IAuthenticationSchemeProvider schemeProvider,
     IEventService events)
 {
     _authService = new AccountAuthService(userManager, signInManager, schemeProvider, interaction, clientStore, events);
 }
        public void Init()
        {
            Debug.Log("HMS GAMES init");
            authService = HMSAccountManager.Instance.GetGameAuthService();

            ITask <AuthAccount> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                InitJosApps(result);
                SignInSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMS GAMES: The app has not been authorized");
                authService.StartSignIn((auth) => { InitJosApps(auth); SignInSuccess?.Invoke(auth); }, SignInFailure);
                InitGameManagers();
            });
        }
        // check this link for different scopes: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/independentsignin-0000001140395573
        public void IndependentSignIn(string accessToken)
        {
            AccountAuthParams  authParams  = new AccountAuthParamsHelper().SetEmail().CreateParams();
            AccountAuthService authService = AccountAuthManager.GetService(authParams);

            Debug.Log("[HMSAccountManager]: Independent Sign in ");
            authService.StartIndependentSignIn(accessToken,
                                               (success) =>
            {
                Debug.LogWarning("[HMSAccountManager]: Independent Sign in Success. Auth Code: " + success.AuthorizationCode);
                OnIndependentSignInSuccess?.Invoke(success);
            },
                                               (error) =>
            {
                Debug.LogError("[HMSAccountManager]: Independent Sign in failed. CauseMessage: " + error.WrappedCauseMessage + ", ExceptionMessage: " + error.WrappedExceptionMessage);
                OnIndependentSignInFailed?.Invoke(error);
            });
        }
        public void Init()
        {
            Debug.Log("HMS GAMES init");
            authService = HMSAccountManager.Instance.GetGameAuthService();

            ITask <AuthAccount> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                HMSAccountManager.Instance.HuaweiId = result;
                Debug.Log("HMS GAMES: Setted app");
                IJosAppsClient josAppsClient = JosApps.GetJosAppsClient();
                Debug.Log("HMS GAMES: jossClient");
                josAppsClient.Init();
                Debug.Log("HMS GAMES: jossClient init");
                InitGameManagers();
                SignInSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMS GAMES: The app has not been authorized");
                authService.StartSignIn(SignInSuccess, SignInFailure);
                InitGameManagers();
            });
        }