Setup OAuth Login by extending with GoLang #4958
Replies: 2 comments
-
Even after the edit I'm still not sure that I understand the use case or the desired outcome and I'm not sure that I'll be able to help you. It seems that you want to interact with PocketBase using regular HTML and forms instead of using JS and the builtin JSON web APIs. If that's the case there are generally 2 options - either modify the response of the specific action to return plain HTML via the available hooks or create custom routes that will more-or-less be the a copy of the existing record routes. You can find the code of the existing OAuth2 route in https://github.com/pocketbase/pocketbase/blob/master/apis/record_auth.go#L178. But if you are going to rewrite everything on your own then you may want to reevaluate whether PocketBase fits your use case because we don't have the necessarily ergonomics at the moment to use it this way. The easiest and recommended way to use PocketBase is by sending direct requests from the client-side (eg. SPA) to the existing JSON web APIs. |
Beta Was this translation helpful? Give feedback.
-
Okay, Like, I want to get the Google URL which shows the Screen to select the Account. Or do I process it completely different and just misunderstood how to use OAuth in that case? Edit: I am searching for similar functionality in Golang itself like shown in the Docx const authData = await pb.collection('users').authWithOAuth2({ provider: 'google' }); Like is there an authWithOAuth2 Function that I can call or do I need to manually add it |
Beta Was this translation helpful? Give feedback.
-
Hey,
I'm working on adding a "Sign in with Google" button to my login page in Pocket Base, using Golang. I've configured the Client ID and Secret in the Admin UI, and set the redirect URL as specified by Pocket Base.
I have the following questions:
Beta Was this translation helpful? Give feedback.
All reactions