unsphere
unsphere6mo ago

Convex Auth Twitter Error

Hey, I set up twitter with convex auth as additional auth for linking the account atm. For primary auth I am using custom ConvexCredentials providers for eth/sol/ton wallet signin which works fine. However after signin with twitter I get the authorize screen but after authorizing it redirects back to previous path because I get the following error in the log at GET /api/auth/callback/twitter
'server responded with an error in the response body
at checkOAuthBodyError (../../node_modules/oauth4webapi/src/index.ts:2656:8)
at async processGenericAccessTokenResponse (../../node_modules/oauth4webapi/src/index.ts:3328:2)
at async processAuthorizationCodeOAuth2Response (../../node_modules/oauth4webapi/src/index.ts:3868:17)
at async handleOAuth (../../node_modules/@convex-dev/auth/src/server/oauth/callback.ts:163:21)
at async <anonymous> (../../node_modules/@convex-dev/auth/src/server/implementation/index.ts:326:34)
at async invokeFunction (../../node_modules/convex/src/server/impl/registration_impl.ts:80:11)
at async invokeHttpAction (../../node_modules/convex/src/server/impl/registration_impl.ts:442:0)
at async <anonymous> (../../node_modules/convex/src/server/router.ts:322:16)'
'server responded with an error in the response body
at checkOAuthBodyError (../../node_modules/oauth4webapi/src/index.ts:2656:8)
at async processGenericAccessTokenResponse (../../node_modules/oauth4webapi/src/index.ts:3328:2)
at async processAuthorizationCodeOAuth2Response (../../node_modules/oauth4webapi/src/index.ts:3868:17)
at async handleOAuth (../../node_modules/@convex-dev/auth/src/server/oauth/callback.ts:163:21)
at async <anonymous> (../../node_modules/@convex-dev/auth/src/server/implementation/index.ts:326:34)
at async invokeFunction (../../node_modules/convex/src/server/impl/registration_impl.ts:80:11)
at async invokeHttpAction (../../node_modules/convex/src/server/impl/registration_impl.ts:442:0)
at async <anonymous> (../../node_modules/convex/src/server/router.ts:322:16)'
Here is the default provider setup from auth.ts I am using:
Twitter({
clientId: convexEnv.TWITTER_CLIENT_ID,
clientSecret: convexEnv.TWITTER_CLIENT_SECRET,
})
Twitter({
clientId: convexEnv.TWITTER_CLIENT_ID,
clientSecret: convexEnv.TWITTER_CLIENT_SECRET,
})
Any idea?
8 Replies
Convex Bot
Convex Bot6mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart6mo ago
Are there any other logs in your Convex dashboard? Seeing the actual error might shed some light
nakajimayoshi
nakajimayoshi2mo ago
@unsphere did you find an answer for this? I’m supposed to demo in an hour for my company and I’m running into the same error This is the same error that’s in the convex dashboard Idk if you’re on the team but it would be nice if we could get much more clear errors than whatever this is.
erquhart
erquhart2mo ago
Broadly, this is what the support model stuff here is referring to: https://labs.convex.dev/auth/config/oauth#providers
OAuth - Convex Auth
Authentication library for your Convex backend
erquhart
erquhart2mo ago
Auth.js, which Convex Auth is built on, has a lot of providers, but they may or may not work out of the box with Convex Auth. GitHub, Google, and Apple are specifically in the support scope currently.
nakajimayoshi
nakajimayoshi2mo ago
I'm using Github OAuth and running in to the same issue same code, same env vars, only difference is running convex locally results in the error, running it on the cloud doesnt.
erquhart
erquhart2mo ago
Ah okay It says error in the response body, can you find out what the error is
nakajimayoshi
nakajimayoshi2mo ago
how would I get that
const { signIn } = useAuthActions();
return (
<Button
className="flex-1"
variant="outline"
type="button"
onClick={async () =>
void (await signIn("github", { redirectTo: "/" })
.then((resp) =>
localStorage.setItem(
"debugGithubOAuthSignInResp",
JSON.stringify(resp),
),
)
.catch((error) => {
localStorage.setItem("debugSignInError", JSON.stringify(error));
console.error("Error during sign in: ", error);
}))
}
/>
);
const { signIn } = useAuthActions();
return (
<Button
className="flex-1"
variant="outline"
type="button"
onClick={async () =>
void (await signIn("github", { redirectTo: "/" })
.then((resp) =>
localStorage.setItem(
"debugGithubOAuthSignInResp",
JSON.stringify(resp),
),
)
.catch((error) => {
localStorage.setItem("debugSignInError", JSON.stringify(error));
console.error("Error during sign in: ", error);
}))
}
/>
);
tried this, nothing of interest showed up

Did you find this page helpful?