W
Wasp-langrithvik12345678

Error when trying to login with google oauth

I recently migrated my codebase from 0.12.4 to 0.13.0 and I'm now having issues when I attempt to login or signup through google. My google config looks like this:
export function getGoogleAuthConfig() {
return {
scopes: ['profile', 'email'], // must include at least 'profile' for Google
};
}
export function getGoogleAuthConfig() {
return {
scopes: ['profile', 'email'], // must include at least 'profile' for Google
};
}
My google get user fields looks like this:
export const getGoogleUserFields = defineUserSignupFields({
email: (data: any) => data.profile.emails[0].value,
username: (data: any) => data.profile.displayName,
isAdmin: (data: any) => adminEmails.includes(data.profile.emails[0].value),
});
export const getGoogleUserFields = defineUserSignupFields({
email: (data: any) => data.profile.emails[0].value,
username: (data: any) => data.profile.displayName,
isAdmin: (data: any) => adminEmails.includes(data.profile.emails[0].value),
});
and I've added the correct redirect uri to my google cloud console as well. Can someone help me figure out what's going wrong here.
K
kapa.ai17d ago
Hi @rithvik12345678. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information you've provided and the knowledge sources, there are a few things you could check: 1. Check your OAuth setup: Ensure that you have correctly updated your OAuth setup as per the migration guide from 0.12.X to 0.13.X. Specifically, make sure you have updated the configFn and userSignupFields fields to use the new profile format. For example, the displayName field should now be accessed via data.profile.name instead of data.profile.displayName (source (https://wasp-lang.dev/docs/migrate-from-0-12-to-0-13#migrate-your-oauth-setup)). 2. Check your OAuth provider's data format: Wasp now directly forwards what it receives from the OAuth providers. You can check the data format for Google in Wasp's docs (source (https://wasp-lang.dev/docs/migrate-from-0-12-to-0-13#migrate-your-oauth-setup)). 3. Check for unique constraint violations: If a user tries to sign up with the same email address using different OAuth providers, it could lead to unique constraint violations if the email field in your User entity has a unique constraint. This could cause the user to be redirected back to the login page without any error message being displayed (source (https://github.com/wasp-lang/wasp/issues/1817)). 4. Check your environment variables: Ensure that you have added the Google client id and secret to your .env.server file (source (https://discord.com/channels/686873244791210014/1208366712450195466)). If you've checked all of these and are still experiencing issues, it might be helpful to provide any error messages you're seeing for further troubleshooting. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @rithvik12345678, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
R
rithvik1234567817d ago
None of these apply to me. @miho do you know anything about this
M
mindreaderlupoDO16d ago
https://discord.com/channels/686873244791210014/1222916615151161374 This thread helped me to fix that issue, I changed the getGoogleUserFields function
M
miho16d ago
What kind of errors do you get? What happens when you try to log in with Google?
R
rithvik1234567816d ago
@miho on the website it says "Validation failed: Cannot read properties of undefined (reading '0')" and I get a 302 error like this: [ Server ] GET /auth/google/callback?state=O2iVwcODfjJZIK7ECMODSp8DBXRfKvWYcYKBL7FvHIY&code=4%2F0AeaYSHCxB3qukDB9eCvMHcnerCnOWCpqwEfw1TJ5yBDXecnWDtAMmUeYxMreeJvYsWI4Zw&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&prompt=consent 302 675.053 ms - - in the terminal
M
miho16d ago
@Vinny (@Wasp) this sounds like old code again?
VW
Vinny (@Wasp)16d ago
Yep. You’ll want to update your code to match this: https://github.com/wasp-lang/open-saas/blob/main/app/src/server/auth/setUsername.ts#L29-L39 We had to make some small changes in auth for the new wasp version
GitHub
open-saas/app/src/server/auth/setUsername.ts at main · wasp-lang/op...
A free, open-source SaaS app starter for React & Node.js with superpowers. Production-ready. Community-driven. - wasp-lang/open-saas
Want results from more Discord servers?
Add your server
More Posts
Password Reset token invalidationHey, could it be that a password token can be reused once it is used? Tried it 3 times with the sameMails not being sent (Mailgun and Sendgrid tested => both haven't even got an API request)Hey, I have setup my main.wasp with my email I have registered and set the APIKey - for password resuiWhich ui component library works well with waspRunning the backend as a regular node.js app?Hi, I'm wondering if it's possible to run the backend as a regular node.js application like 'npm staWhere to startIm a UI designer dabbling in trying to create my first app w/ GitHub code pilot as I’m not a developrunning wasp inside google idx errorI am trying to setup the dev environment test out opensaas with google online ide idx, but when I trApp crashed for unknowing reasonHey, I start the app when it's still v-0.12.0, it works fine till today, nothing changed on my end btrying to run wasp.sh server on dockerHey guys, so I tried dockerising wasp-sh after I saw it on your recent reddit post. 1. I created aConfused about [Client ]HMR[Wasp 0.13.0, MacOs] Hey guys, I am trying to update wasp header/nav bar to a new style with framerIssue with deploying my wasp app to fly.ioI'm trying to deploy my wasp app to fly.io, but I'm encountering an error that doesn't make sense. Whas anyone got shadcn to work with wasp? I am trying but keep getting an errorAttached is the error I am currently getting. Just wondering if anyone has had success with it?"wasp start db" takes too much time.Any solution for this? i seem to be stuck in a loop and i can't do "Wasp start" until this resolves.Best Practices for Implementing Auth System in Chrome Extension Connected to OpenSaaSHello, everyone! I'm currently developing a SaaS product and have created a Chrome extension. I'm aCompile / Parse error with the ToDoApHello all , I just downloaded and installed Wasp on Windows 11 with WSL2. The installation wenPossibility to disable wasp reload on UI file changes?Hey my dudes, is it possible to calm down this guy on the screenshot from reloading everything everyWhat's the best way to start with Wasp?I'm looking for the best way to start with learning Wasp.onAuthSucceededRedirectTo previous siteWhen I open a Link in my app where Auth is required but my session expired, I get redirected to the Is there something missing? :(I'm following this guide. https://wasp-lang.dev/blog/2023/11/21/guide-windows-development-wasp-wsl Bdynamic variables in main.waspIs it currently possible to dynamically change configuration values in main.wasp? E.g for developmGoogle Auth in ProdI made my first try with the wasp deployment. So far its pretty straightforward, directly deploy to