a-tokyo / apple-signin-auth

 Apple signin for nodeJS.
MIT License
152 stars 35 forks source link

FetchError: invalid json response body at https://appleid.apple.com/auth/revoke #138

Closed dauden closed 2 years ago

dauden commented 2 years ago

as of version 1.7.1 when I'm trying to call revokeAuthorizationToken I got an issue. with the response body to JSON.

Error details:

FetchError: invalid json response body at https://appleid.apple.com/auth/revoke reason: Unexpected end of JSON input | CorrelationId: 507783AA-58EA-41EC-9984-0ABD52701AE3_1655970089157 FetchError: invalid json response body at https://appleid.apple.com/auth/revoke reason: Unexpected end of JSON input

I think it from here:

return fetch(url.toString(), { method: 'POST', body: params, }).then((res) => res.json());

We should check the 'res' is empty |null before convert to JSON.

a-tokyo commented 2 years ago

https://github.com/A-Tokyo/apple-signin-auth/pull/139