Bug
The loginProvider in Bluesky.swift discards the HTTP response status and tries to decode any response body as a TokenResponse.
When a token endpoint returns a 4xx error (e.g., {"error":"invalid_grant"}), it produces a misleading DecodingError: missing key 'access_token' instead of surfacing the actual error.
Affected code:
let (data, _) = try await params.responseProvider(request)
let tokenResponse = try JSONDecoder().decode(TokenResponse.self, from: data)
Fix: Check HTTP status code before decoding, like refreshProvider already does.
Found while integrating OAuthenticator into Inkwell (AT Protocol client for iOS).
Bug
The
loginProviderinBluesky.swiftdiscards the HTTP response status and tries to decode any response body as aTokenResponse.When a token endpoint returns a 4xx error (e.g.,
{"error":"invalid_grant"}), it produces a misleadingDecodingError: missing key 'access_token'instead of surfacing the actual error.Affected code:
Fix: Check HTTP status code before decoding, like
refreshProvideralready does.Found while integrating OAuthenticator into Inkwell (AT Protocol client for iOS).