Issue Converting "phone" value to type Firebase.Auth.FirebaseProviderType
derekwelton opened this issue · 0 comments
derekwelton commented
I just upgraded to version 4.0.1, originally on 3.7 something. Looks like there have been a number of changes since 3.7.
When I run below:
var user = await _client.SignInWithEmailAndPasswordAsync("myemail@gmail.com", "secretPassword");
I get the following Exception:
---> Newtonsoft.Json.JsonSerializationException: Error converting value "phone" to type 'Firebase.Auth.FirebaseProviderType'. Path 'users[0].providerUserInfo[0].providerId', line 14, position 31.
---> System.ArgumentException: Requested value 'phone' was not found.
at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
It looks like the exception is coming from:
at Firebase.Auth.Requests.FirebaseRequestBase`2.ExecuteAsync(TRequest request)
at Firebase.Auth.Providers.EmailProvider.GetUserInfoAsync(String idToken)
at Firebase.Auth.Providers.EmailProvider.SignInWithCredentialAsync(AuthCredential credential)
at Firebase.Auth.FirebaseAuthClient.SignInWithEmailAndPasswordAsync(String email, String password)
at IronwoodConfigurator.Api.Modules.Users.AdminLogin.AdminLoginEndpoint.HandleAsync(CancellationToken c) in C:\Development\CSharp\Ironwood-Configurator\src\IronwoodConfigurator.Api\Modules\Users\AdminLogin\AdminLoginEndpoint.cs:line 27
Here is the full exception if that helps.
Firebase.Auth.FirebaseAuthHttpException: Exception occured during Firebase Http request.
Url: https://www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=[my api key]
Request Data: {"idToken":"[there was a token value in here]"}
Response: {
"kind": "identitytoolkit#GetAccountInfoResponse",
"users": [
{
"localId": "00JhIAuwIMUN8HlRNAH22KwhrZn2",
"email": "myemail@gmail.com",
"displayName": "Root Admin",
"photoUrl": "http://www.example.com/12345678/photo.png",
"passwordHash": "4adasd32dsas",
"emailVerified": true,
"passwordUpdatedAt": 1674500821362,
"providerUserInfo": [
{
"providerId": "phone",
"rawId": "+12345678900",
"phoneNumber": "+12345678900"
},
{
"providerId": "password",
"displayName": "Root Admin",
"photoUrl": "http://www.example.com/12345678/photo.png",
"federatedId": "myemail@gmail.com",
"email": "myemail@gmail.com",
"rawId": "myemail@gmail.com"
}
],
"validSince": "1674500821",
"disabled": false,
"lastLoginAt": "1674514320448",
"createdAt": "1674500821362",
"phoneNumber": "+12345678900",
"customAttributes": "{\"admin\":true,\"app_user_id\":2}",
"lastRefreshAt": "2023-01-23T22:52:00.448Z"
}
]
}
Reason: Unknown
---> Newtonsoft.Json.JsonSerializationException: Error converting value "phone" to type 'Firebase.Auth.FirebaseProviderType'. Path 'users[0].providerUserInfo[0].providerId', line 14, position 31.
---> System.ArgumentException: Requested value 'phone' was not found.
at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Firebase.Auth.Requests.FirebaseRequestBase`2.ExecuteAsync(TRequest request)
--- End of inner exception stack trace ---
at Firebase.Auth.Requests.FirebaseRequestBase`2.ExecuteAsync(TRequest request)
at Firebase.Auth.Providers.EmailProvider.GetUserInfoAsync(String idToken)
at Firebase.Auth.Providers.EmailProvider.SignInWithCredentialAsync(AuthCredential credential)
at Firebase.Auth.FirebaseAuthClient.SignInWithEmailAndPasswordAsync(String email, String password)
at IronwoodConfigurator.Api.Modules.Users.AdminLogin.AdminLoginEndpoint.HandleAsync(CancellationToken c) in C:\Development\CSharp\Ironwood-Configurator\src\IronwoodConfigurator.Api\Modules\Users\AdminLogin\AdminLoginEndpoint.cs:line 27
at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)