W
Wasp5mo ago
haarismian

How to edit google oauth credits

I want to be able to edit the number of credits an account has, both locally and in prod, for google accounts, how can I do that. I know for normal email accounts I can use wasp db studio and edit
9 Replies
kapa.ai
kapa.ai5mo ago
Hi @haarismian. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To edit the number of credits an account has, you would typically need to interact with your database. In Wasp, you can use the wasp db studio command to open Prisma Studio, which provides a GUI for interacting with your database. However, from the knowledge sources provided, there isn't a direct way mentioned to edit Google OAuth credits. Google OAuth in Wasp is used for authentication, allowing users to log in using their existing Google accounts. It doesn't inherently deal with any 'credits' associated with a user account. The 'credits' concept seems to be specific to your application's business logic. If 'credits' is a field in your User entity in your database, you could potentially update it using Prisma's update methods. A community member in a Discord thread was looking for a way to update a database value by referencing the value of another field. If this is similar to what you're trying to achieve, you might find the discussion helpful. However, the exact method to do this in Wasp wasn't provided in the knowledge sources. For more specific guidance, you might want to refer to the Prisma documentation or the Wasp documentation, or ask in the Wasp community for help with your specific use case. Sources: - Discord support thread: Update DB Field using Another Field (https://discord.com/channels/686873244791210014/1216150994157834350) - Docs > Auth > Social-auth > Google (https://wasp-lang.dev/docs/auth/social-auth/google) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
Filip
Filip5mo ago
Wasp studio should work for google accounts as well. Why is it an issue? Of course, you shouldn't be using Wasp studio as a substitute for business logic. It's just a debugging tool.
haarismian
haarismianOP5mo ago
@sodic and @kapa.ai I was able to solve it for local. I have a system based on the initial template of credits used for each action in my app, however for trial users I wanted to manually adjust the credits (my friend signed up I want to give them 100 credits for example). the google auth users appear as blank username and password in the users table. @kapa.ai how can I make db edits in prod when it is deployed to fly.io
kapa.ai
kapa.ai5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To interact with your production database deployed on Fly.io, you can open a tunnel to your Fly production database using the fly proxy command. Here are the steps: 1. Open a tunnel to your Fly production database:
fly proxy 5432 -a <db-name>

fly proxy 5432 -a <db-name>

2. After opening the tunnel, you can execute wasp db studio to interact with your database using Prisma Studio. Please remember to remove the DATABASE_URL with the production database URL from .env.server if you put it there, to avoid accidentally making changes to the production database later. If you encounter any issues while initiating a new app, you should run flyctl apps destroy <app-name> before trying again. Fly does not allow you to create multiple apps with the same name. Sources: - Discord support thread: How to interact with database in prisma studio after deployment? (https://discord.com/channels/686873244791210014/1220423321422663820) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
Vinny (@Wasp)
Vinny (@Wasp)5mo ago
this should work for all users, regardless of the Auth provider. You're using Open SaaS, right? Can you share the contents of your src/auth/userSignupFields.ts file? also, in your main.wasp is google using the userSignupFields override, liek this:
google: { // Guide for setting up Auth via Google
userSignupFields: import { getGoogleUserFields } from "@src/auth/userSignupFields",
configFn: import { getGoogleAuthConfig } from "@src/auth/userSignupFields",
},
google: { // Guide for setting up Auth via Google
userSignupFields: import { getGoogleUserFields } from "@src/auth/userSignupFields",
configFn: import { getGoogleAuthConfig } from "@src/auth/userSignupFields",
},
haarismian
haarismianOP5mo ago
@kapa.ai when I added the database_url I am able to run the fly proxy command but when I run wasp db studio I get this error "The database needs to be running in order to execute this command. You can easily start a managed dev database with wasp start db."
kapa.ai
kapa.ai5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message you're seeing typically appears when Wasp is unable to connect to the database. This could be due to several reasons: 1. The database is not running: Ensure that your database is up and running. If you're using a local database, you can start it using the wasp start db command. 2. Incorrect DATABASE_URL: The DATABASE_URL in your .env.server file might be incorrect. Ensure that it points to the correct database instance. 3. Network issues: If you're trying to connect to a remote database, there might be network issues preventing the connection. Ensure that your network allows connections to the database. 4. Docker not running: If you're using Docker and it's not running, you might see this error. Ensure that Docker is installed and running. If you're trying to connect to your production database via a tunnel using fly proxy, ensure that the tunnel is up and running. You might need to keep the terminal window where you ran fly proxy open while you're using the database. If you're still having issues, you might want to ask for help in the Wasp community or check the Wasp and Prisma documentation for more information. Sources: - Github Issue (closed): wasp-cli command not handling white-space in path while running app (https://github.com/wasp-lang/wasp/issues/1486) - Docs > Data-model > Databases > Connecting to a Database (https://wasp-lang.dev/docs/data-model/backends#connecting-to-a-database) - Discord support thread: Need help running Wasp app (https://discord.com/channels/686873244791210014/1215223623271321661) - Github Issue (open): Have wasp start db produce nice warning message if docker daemon is not running (https://github.com/wasp-lang/wasp/issues/1135) - Github Issue (open): [Managed dev db] Allow automatic and/or manual choosing of another port than 5432 (https://github.com/wasp-lang/wasp/issues/1049) - Github Issue (closed): Fix database initialization (https://github.com/wasp-lang/wasp/issues/1435) - Github Issue (closed): During development, produce a nice error message for user if database is not running but it should be (https://github.com/wasp-lang/wasp/issues/1051) - Discord support thread: Cant start database docker is not working on wsl properly (https://discord.com/channels/686873244791210014/1194876839911510046) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @haarismian, 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?
miho
miho5mo ago
GitHub
GitHub - wasp-lang/learning-materials: A place to collect some usef...
A place to collect some useful learning materials for Wasp - wasp-lang/learning-materials
haarismian
haarismianOP5mo ago
@miho thank yo ufor sharing, I was able to follow those instructions to make that happen and it worked thank you
Want results from more Discord servers?
Add your server