W
Wasp12mo ago
pearcy

Unable to access the Dashboard as an admin user

When I spin up a open-saas repo (https://github.com/wasp-lang/open-saas.git) everything works swimmingly except I am unable to access to the Dashboard as an admin user. -- running locally, Docker Postgres, dev env changes: // app/.env.server [email protected] // app/main.wasp isAdmin Boolean @default(true) Expected behavior: After these env changes, I signup and should have access to the Dashboard. -- there is nothing in my account in nav so enter /admin directly in the URL. If I change all the values to "false", I can get access to the Dashboard but when I go back to account or demo-app it routes me to the login screen. // app/main.wasp ``` route AdminRoute { path: "/admin", to: DashboardPage } page DashboardPage { authRequired: false, component: import Dashboard from "@client/admin/pages/DashboardPage" }
GitHub
GitHub - wasp-lang/open-saas: An open-source SaaS app template with...
An open-source SaaS app template with superpowers. Contribute to wasp-lang/open-saas development by creating an account on GitHub.
6 Replies
Vinny (@Wasp)
Vinny (@Wasp)12mo ago
It sounds like you don’t have Auth set up. What Auth method are you using? Is the console showing errors? Admin route should be authRequired If you can copy and paste these I can help you more. Lemme know when you do
pearcy
pearcyOP12mo ago
I went back through the online docs and maybe what I am trying to do is not easily done - I am trying use out of the box functionality ant understand how the app works/ At this link: https://docs.opensaas.sh/start/guided-tour/ This instruction/example make it appear as if I can login via email as an admin user without verification (e.g. from Sendmail) with the following settings. *** this is for local dev testing. //app/.env.server # set this as a comma-separated list of emails you want to give admin privileges to upon registration [email protected] entity User settings: // app/main.wasp
isAdmin Boolean @default(true)
isEmailVerified Boolean @default(false)
isAdmin Boolean @default(true)
isEmailVerified Boolean @default(false)
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
email: {},
google: {},
github: {},
},
onAuthFailedRedirectTo: "/",
},
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
email: {},
google: {},
github: {},
},
onAuthFailedRedirectTo: "/",
},
I then go to the Authentition docs and it seems to indicate that this config would work.
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
usernameAndPassword: {},
email: {},
google: {},
gitHub: {},
},
onAuthFailedRedirectTo: "/",
},
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
usernameAndPassword: {},
email: {},
google: {},
gitHub: {},
},
onAuthFailedRedirectTo: "/",
},
and that, IF I wanted "Email Verified Auth" I would then uncomment out the "Sendmail Auth code" and use that scheme. After looking at the code it appears that if I use "email" for auth I also need to configure it with a Sendmail like provider (requires verification). Is that correct? My goal is for local dev testing so I am trying to review, test the app and to use the simplest sign in method for viewing the demo-app, account and dashboard. And I realize that dashboard should be set to "true" for "Auth" and set it to "false" just so I could see the dashboard.
route AdminRoute { path: "/admin", to: DashboardPage }
page DashboardPage {
authRequired: true,
component: import Dashboard from "@client/admin/pages/DashboardPage"
}
route AdminRoute { path: "/admin", to: DashboardPage }
page DashboardPage {
authRequired: true,
component: import Dashboard from "@client/admin/pages/DashboardPage"
}
OpenSaaS.sh
Guided Tour
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
Vinny (@Wasp)
Vinny (@Wasp)12mo ago
for testing, if you want to use the simplest method, remove them all except usernameAndPassword. then, sign up and log in with a test user, and in another terminal, from the root of the project, run wasp db studio. you should see that user you just signed up with and that isAdmin = true if you want to use email verified login, you can't use usernameAndPassword at the same time (although you can use google and github with usernameAndPassword)
pearcy
pearcyOP12mo ago
Ok, thank you! Btw, everything works great. Impressed with your scripts, mutations, etc. Very easy on the dev.
Vinny (@Wasp)
Vinny (@Wasp)12mo ago
Great to hear. That’s the idea 🙂 Let us know if you have any other questions. Happy to help. What are your looking to build btw? also, if this specific problem has been resolved, I will close this thread. let me know.
pearcy
pearcyOP12mo ago
We are evaluating different development platforms so we can add functionality to an existing React Native app, which includes a React version. Our current app is directly connected to Supabase, so we don't have a platform to leverage. Yes, the issue is resolved.
Want results from more Discord servers?
Add your server