aspnet-contrib / AspNet.Security.OAuth.Providers

OAuth 2.0 social authentication providers for ASP.NET Core
Apache License 2.0
2.38k stars 538 forks source link

Vkontakte Provider - KeyNotFoundException: The given key was not present in the dictionary. #769

Closed serega9i closed 3 weeks ago

serega9i commented 1 year ago

Describe the bug

In case of unsuccessful authorization, the VK response does not contain the "response" property, therefore it throws a KeyNotFoundException

using var enumerator = container.RootElement.GetProperty("response").EnumerateArray();

Expected behaviour

In case of unsuccessful authorization, VK response an "error" property instead of a "response". If there is an "error" property in the root, throw the custom exception

Actual behaviour

In case of unsuccessful authorization, the VK response does not contain the "response" property, therefore it throws a KeyNotFoundException

martincostello commented 1 year ago

Thanks for the report.

If you could provide a full sample response for when there's an error, or even better submit a pull request with a proposed fix for it, then this is likely to get fixed sooner.

serega9i commented 1 year ago

Thanks for the report.

If you could provide a full sample response for when there's an error, or even better submit a pull request with a proposed fix for it, then this is likely to get fixed sooner.

PR