You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented Google login using remix-auth-oauth2 and remix-auth-google, based on remix-on-bun by @sergiodxa . However, I encountered an "Unexpected end of JSON input" error when calling authenticator.authenticate in the callback.
Upon investigation, I found that the issue is due to the lack of Response.clone implementation in Bun. This causes an error in response.json() when getAccessToken tries to read from a cloned response created in fetchAccessToken.
While waiting for Bun to implement this might be an option, it seems unnecessary to clone the response in fetchAccessToken in the first place.
I've managed to get it working by applying the following patch on my end. Is cloning really necessary?
diff --git a/node_modules/remix-auth-oauth2/build/index.js b/node_modules/remix-auth-oauth2/build/index.js
index 78f2712..1597705 100644
--- a/node_modules/remix-auth-oauth2/build/index.js+++ b/node_modules/remix-auth-oauth2/build/index.js@@ -251,7 +251,7 @@ class OAuth2Strategy extends remix_auth_1.Strategy {
let body = await response.text();
throw body;
}
- return await this.getAccessToken(response.clone());+ return await this.getAccessToken(response);
}
}
exports.OAuth2Strategy = OAuth2Strategy;
The text was updated successfully, but these errors were encountered:
I implemented Google login using remix-auth-oauth2 and remix-auth-google, based on remix-on-bun by @sergiodxa . However, I encountered an "Unexpected end of JSON input" error when calling authenticator.authenticate in the callback.
Upon investigation, I found that the issue is due to the lack of Response.clone implementation in Bun. This causes an error in response.json() when getAccessToken tries to read from a cloned response created in fetchAccessToken.
While waiting for Bun to implement this might be an option, it seems unnecessary to clone the response in fetchAccessToken in the first place.
I've managed to get it working by applying the following patch on my end. Is cloning really necessary?
The text was updated successfully, but these errors were encountered: