コード例 #1
0
        private static async Task <string> SignInWithCustomTokenAsync(string customToken)
        {
            var rb = new Google.Apis.Requests.RequestBuilder()
            {
                Method  = Google.Apis.Http.HttpConsts.Post,
                BaseUri = new Uri(VerifyCustomTokenUrl),
            };

            rb.AddParameter(RequestParameterType.Query, "key", IntegrationTestUtils.GetApiKey());
            var request        = rb.CreateRequest();
            var jsonSerializer = Google.Apis.Json.NewtonsoftJsonSerializer.Instance;
            var payload        = jsonSerializer.Serialize(new SignInRequest
            {
                CustomToken       = customToken,
                ReturnSecureToken = true,
            });

            request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
            using (var client = new HttpClient())
            {
                var response = await client.SendAsync(request);

                response.EnsureSuccessStatusCode();
                var json = await response.Content.ReadAsStringAsync();

                var parsed = jsonSerializer.Deserialize <SignInResponse>(json);
                return(parsed.IdToken);
            }
        }
コード例 #2
0
        private static async Task <string> ResetPasswordAsync(ResetPasswordRequest data)
        {
            var rb = new Google.Apis.Requests.RequestBuilder()
            {
                Method  = Google.Apis.Http.HttpConsts.Post,
                BaseUri = new Uri(ResetPasswordUrl),
            };

            rb.AddParameter(RequestParameterType.Query, "key", IntegrationTestUtils.GetApiKey());

            var jsonSerializer = Google.Apis.Json.NewtonsoftJsonSerializer.Instance;
            var payload        = jsonSerializer.Serialize(data);

            var request = rb.CreateRequest();

            request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
            using (var client = new HttpClient())
            {
                var response = await client.SendAsync(request);

                response.EnsureSuccessStatusCode();
                var json = await response.Content.ReadAsStringAsync();

                var parsed = jsonSerializer.Deserialize <Dictionary <string, object> >(json);
                return((string)parsed["email"]);
            }
        }
コード例 #3
0
            public GetUsersFixture()
            {
                IntegrationTestUtils.EnsureDefaultApp();

                this.TestUser1 = NewUserWithParamsAsync().Result;
                this.TestUser2 = NewUserWithParamsAsync().Result;
                this.TestUser3 = NewUserWithParamsAsync().Result;

                // The C# port doesn't support importing users, so unlike the other ports, there's
                // no way to create a user with a linked federated provider.
                // TODO(rsgowman): Once either FirebaseAuth.ImportUser() exists (or the UpdateUser()
                // method supports ProviderToLink (#143)), then use it here and
                // adjust the VariousIdentifiers() test below.
            }
コード例 #4
0
 public FirebaseAuthTest()
 {
     IntegrationTestUtils.EnsureDefaultApp();
 }
コード例 #5
0
 public FirebaseMessagingTest()
 {
     IntegrationTestUtils.EnsureDefaultApp();
 }
コード例 #6
0
 public StorageClientHelperTest()
 {
     IntegrationTestUtils.EnsureDefaultApp();
 }