Vivek S
WWasp
•Created by Vivek S on 5/13/2024 in #đŸ™‹questions
Error 400: redirect_uri_mismatch
đŸ˜„ Thank you @miho !
83 replies
WWasp
•Created by Vivek S on 5/13/2024 in #đŸ™‹questions
Error 400: redirect_uri_mismatch
where do i add the code you provided? @kapa.ai Does it go into the main.wasp file?
83 replies
WWasp
•Created by Vivek S on 5/13/2024 in #đŸ™‹questions
Error 400: redirect_uri_mismatch
my setusername.ts was defaulted to the following - "
import { defineUserSignupFields } from 'wasp/auth/providers/types';
const adminEmails = process.env.ADMIN_EMAILS?.split(',') || [];
export const getEmailUserFields = defineUserSignupFields({
username: (data: any) => data.email,
isAdmin: (data: any) => adminEmails.includes(data.email),
email: (data: any) => data.email,
});
export const getGitHubUserFields = defineUserSignupFields({
// NOTE: if we don't want to access users' emails, we can use scope ["user:read"]
// instead of ["user"] and access args.profile.username instead
email: (data: any) => data.profile.emails[0].email,
username: (data: any) => data.profile.login,
isAdmin: (data: any) => adminEmails.includes(data.profile.emails[0].email),
});
export function getGitHubAuthConfig() {
return {
scopes: ['user'],
};
}
export const getGoogleUserFields = defineUserSignupFields({
email: (data: any) => data.profile.email,
username: (data: any) => data.profile.name,
isAdmin: (data: any) => adminEmails.includes(data.profile.email),
});
export function getGoogleAuthConfig() {
return {
scopes: ['profile', 'email'], // must include at least 'profile' for Google
};
}
"
what do i need to fix to make it work? @kapa.ai
83 replies
WWasp
•Created by Vivek S on 5/13/2024 in #đŸ™‹questions
Error 400: redirect_uri_mismatch
my auth section in main.wasp looks like this by default - "
auth: {
userEntity: User,
methods: {
email: {
fromField: {
name: "Open SaaS App",
email: "[email protected]"
},
emailVerification: {
clientRoute: EmailVerificationRoute,
getEmailContentFn: import { getVerificationEmailContent } from "@src/server/auth/email.js",
},
passwordReset: {
clientRoute: PasswordResetRoute,
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/server/auth/email.js",
},
userSignupFields: import { getEmailUserFields } from "@src/server/auth/setUsername.js",
},
google: { // Guide for setting up Auth via Google https://wasp-lang.dev/docs/auth/social-auth/overview
userSignupFields: import { getGoogleUserFields } from "@src/server/auth/setUsername.js",
configFn: import { getGoogleAuthConfig } from "@src/server/auth/setUsername.js",
},
// gitHub: {
// userSignupFields: import { getGitHubUserFields } from "@src/server/auth/setUsername.js",
// configFn: import { getGitHubAuthConfig } from "@src/server/auth/setUsername.js",
// },
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/demo-app",
},
"
I just uncommented the google part. @kapa.ai
83 replies
WWasp
•Created by Vivek S on 5/13/2024 in #đŸ™‹questions
Error 400: redirect_uri_mismatch
@kapa.ai I am hosting it locally, and so I checked OAuth in google console, and it's correctly setup, but im still getting the same error.
83 replies