authWithOAuth2Code gives 404 #3743
-
hi! for some reason, the manual OAuth2 flow is not working for me. this is the call which is not working: const { record, meta } = await locals.pb
.collection('users')
.authWithOAuth2Code(provider.name, code, provider.codeVerifier, env.AUTH_REDIRECT_URL); in my SvelteKit logs, I get:
which seems strange. based on my interactions with the demo site, it seems like a GET request is issued instead of a POST request. I wonder if that is the case and why? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
nevermind, with
|
Beta Was this translation helpful? Give feedback.
-
okay, so I intercepted the call in the debugger and made a curl call instead:
so not sure why the |
Beta Was this translation helpful? Give feedback.
-
as seen above, the requests do make it to the pocketbase server but as GET requests instead of POST requests |
Beta Was this translation helpful? Give feedback.
-
for me, it's enough to add a // src/routes/auth/demo/+server.ts
export const GET = async ({ locals }) => {
await locals.pb
.collection('users')
.authWithOAuth2Code('not-a-real-provider', 'abc123', 'test123', 'example.com');
return new Response('ok');
}; to trigger this:
not sure what's going on! |
Beta Was this translation helpful? Give feedback.
-
Does using the "Manual code exchange" example with the static html files in |
Beta Was this translation helpful? Give feedback.
-
it was this setting in caprover: I disabled this and it's working now! 🎉 |
Beta Was this translation helpful? Give feedback.
Hm, I'm not sure why the above logs are happening. The closest I could find was this old issue caprover/caprover#167, where the users mention that it could be due to http->https redirect. To rule it out, if not already, try to use https url scheme when initializing the JS SDK.