js-sdk: Can't get OAuth2 login to work

The only documentation related to OAuth login is this:

const userAuthData2 = await client.Users.authViaOAuth2("google", "CODE", "VERIFIER", "REDIRECT_URL");

But there is no indication of what “CODE” and “VERIFIER” mean, or how to use them. Can you add a more complete example of how to use this?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I don’t think we can implement it the same way unless we add sessions/cookies (even if we store the redirect url in the database we’ll have to link it to the previous request somehow, hence the sessions/cookies).

… sending both an error object and the authData at the same time. Because the way Pocketbase works now, it throws an error when you have an invalid email or password, and it doesn’t handle it gracefully.

What do you mean by gracefully? In PocketBase I don’t think it will make sense to return both error and user data because you don’t have any user data when the request doesn’t succeed (if we were using sessions or “guest logins” then it may make sense to have them as a fallback). The error message for email/pass login is intentionally generic to avoid (to some extend) users enumeration.

But I’ll have a more detailed look at Supabase’s API this weekend.