File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/AspNet.Security.OAuth.Vkontakte Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,19 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync(
49
49
}
50
50
51
51
using var container = JsonDocument . Parse ( await response . Content . ReadAsStringAsync ( Context . RequestAborted ) ) ;
52
- using var enumerator = container . RootElement . GetProperty ( "response" ) . EnumerateArray ( ) ;
52
+
53
+ if ( ! container . RootElement . TryGetProperty ( "response" , out var profileResponse ) )
54
+ {
55
+ if ( container . RootElement . TryGetProperty ( "error" , out var error ) &&
56
+ error . ValueKind is JsonValueKind . String )
57
+ {
58
+ throw new InvalidOperationException ( $ "An error occurred while retrieving the user profile: { error . GetString ( ) } ") ;
59
+ }
60
+
61
+ throw new InvalidOperationException ( "An error occurred while retrieving the user profile." ) ;
62
+ }
63
+
64
+ using var enumerator = profileResponse . EnumerateArray ( ) ;
53
65
var payload = enumerator . First ( ) ;
54
66
55
67
var principal = new ClaimsPrincipal ( identity ) ;
You can’t perform that action at this time.
0 commit comments