示例#1
0
        private string GetProviderId(FirebaseAuthType authType)
        {
            switch (authType)
            {
            case FirebaseAuthType.Facebook:
            case FirebaseAuthType.Google:
            case FirebaseAuthType.Github:
            case FirebaseAuthType.Twitter:
                return(authType.ToEnumString());

            case FirebaseAuthType.EmailAndPassword:
                throw new InvalidOperationException("Email auth type cannot be used like this. Use methods specific to email & password authentication.");

            default: throw new NotImplementedException("");
            }
        }
示例#2
0
        /// <summary>
        /// Unlinks the given <see cref="authType"/> from the account associated with <see cref="firebaseToken"/>.
        /// </summary>
        /// <param name="firebaseToken"> The FirebaseToken (idToken) of an authenticated user. </param>
        /// <param name="authType"> The auth type.  </param>
        /// <returns> The <see cref="FirebaseAuthLink"/>.  </returns>
        public async Task <FirebaseAuthLink> UnlinkAccountsAsync(string firebaseToken, FirebaseAuthType authType)
        {
            string providerId = null;

            if (authType == FirebaseAuthType.EmailAndPassword)
            {
                providerId = authType.ToEnumString();
            }
            else
            {
                providerId = this.GetProviderId(authType);
            }

            var content = $"{{\"idToken\":\"{firebaseToken}\",\"deleteProvider\":[\"{providerId}\"]}}";

            return(await this.ExecuteWithPostContentAsync(GoogleSetAccountUrl, content).ConfigureAwait(false));
        }