p4j4r5
p4j4r5
WWasp-lang
Created by p4j4r5 on 10/16/2024 in #đŸ™‹questions
How to build the just web-app
Directory .wasp/build/web-app won't exist unless I run wasp build
7 replies
WWasp-lang
Created by p4j4r5 on 10/14/2024 in #đŸ™‹questions
How to install paritcular version of wasp
Thanks a lot. That helps
6 replies
WWasp-lang
Created by atomic-peter on 10/11/2024 in #đŸ™‹questions
Add credits to each subscription
I m working on something similar Monthly subscription - Max 100 A items and total 100 items B Credit purchase - if user on free plan, Max A items changes to 50 ( with expiry of 2 months) and total 50 items B - If a monthly subscriber purchases credit purchase because he ran out of B, then Max A still remain at 100, while B increase it by 50. Seems this is possible , by tweaking plan effect and passing those to be updated by the method updateUserStripePaymentDetails in webhook.ts
11 replies
WWasp-lang
Created by p4j4r5 on 10/10/2024 in #đŸ™‹questions
How to create a credit plan where I want to provide credits to multiple user features
Having different plan for different feature isn't desirable. As User have to pay many times to get to use features.
11 replies
WWasp-lang
Created by p4j4r5 on 9/26/2024 in #đŸ™‹questions
how to debug wasp api endpoint using breakpoints
Hadn't had a chance yet will give this try later today
10 replies
WWasp-lang
Created by p4j4r5 on 9/30/2024 in #đŸ™‹questions
Opensaas
Figured it out. The UI on stripe has changed. We need to click on each of the product and then it displays price and clicking three dots there is option to copy Price ID.
7 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Not sure if it is documentation or something that could help to add custom Provider might help.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Thanks a lot for sharing the this gist that involved custom Oauth provider. It gave me more insight on the methods we have within the framework to search/create user
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
@miho Here is the E2E code . Had a challenge with redirection from google to chrom extension as the extension popup doesn't stay on when Oauth flow is triggered. Workaround was to intiatiate the launchWebFlow from background script instead https://gist.github.com/yashomi-t3h/79f738a1006b4b8b0d73dd354471f83e
23 replies
WWasp-lang
Created by p4j4r5 on 9/26/2024 in #đŸ™‹questions
how to debug wasp api endpoint using breakpoints
@sodic Thanks a lot. I will give it try to do manually
10 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Sure will share the code soon.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Managed to create an API endpoint that takes in google oauth code from client and validate the user by fetching access token and user profile info from google api's. Eventually return the onetime token. @miho Thanks a lot for sharing the reference code.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Thanks a lot.. I will give it try using what is been doinf for spotify custom OAuth.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
I am not able to figure out the code for user creation within the wasp. When a user is created, its is updated in four places from what I see. - user table with user ID and user email - auth table with ID and user ID from user table. - auth identity table capturing what is the authentication provider ( google here ) and then corresponding auth id from auth table - session id with expiry and auth id I primarily want session id in exchange to ID_token I received from google on extension. I see the existing /auth/exchange-code is for exchanging internal one time tokens and will not work for ID Token returned by google. To work around this, I may need to create new endpoint that - takes in the google ID_token, validates it against google email against the email, aud, etc. - on successful validation, check if there is user already exist . if existing user, create a new JWT token with authID from userid and expiry . - using this token then use the /auth/exchange-code token to get a session ID. This work around may only work for existing users. For new users, when they fail the check , I might need to reroute them to portal to create user.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
The above code is an example of handler for login button on chrome extension. Using chrome.identity.launchWebAuthFlow allows me use same Oauth credential app for both extension and portal
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
const handleLogin = () => { try { const authUrl = new URL("https://accounts.google.com/o/oauth2/v2/auth") const clientId = "<from oauth settings>" const redirectUri = chrome.identity.getRedirectURL() const state = Math.random().toString(36).substring(7) const scopes = "profile email" authUrl.searchParams.set("state", state) authUrl.searchParams.set("client_id", clientId) authUrl.searchParams.set("redirect_uri", redirectUri) authUrl.searchParams.set("scope", scopes) authUrl.searchParams.set("response_type", "code token id_token") authUrl.searchParams.set("access_type", "offline") authUrl.searchParams.set("include_granted_scopes", "true") authUrl.searchParams.set("prompt", "consent") authUrl.searchParams.set("nonce", "1") chrome.identity.launchWebAuthFlow( { url: authUrl.href, interactive: true, }, async (redirectUrl) => { if (chrome.runtime.lastError || !redirectUrl) { return new Error( WebAuthFlow failed: ${chrome.runtime.lastError.message}, ) } console.log(redirectUrl, "redirectUrl") const params = new URLSearchParams(redirectUrl.split("?")[1]) const code = params.get("code") if (!code) { return new Error("No code found") } }, ) } catch (error) { throw new Error(Sign-in failed: ${error.message}) } };
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Idea is that a user can login via chrome extenstion or via the portal ( which is setup using opensaas). I am planning to use google oauth in this case. I have setup Oauth credentials in google cloud console as web application and then it has both redirects authorized ( server one - development and chrome extension one). So in essence same Oauth client ID works for both. On server I am able to login without any issues. On chrome, I manage to get to point where I recieve Oauth ID_token . It is a valid jwt token with hash algorithm RS256 instead. I was hoping to exchange that token to create session on backend and then allow user to make calls to api via extension.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
the ID_token provided by google is a RSA algorithm based token and the wasp-lang seems to only support HMAC algorithim.
23 replies
WWasp-lang
Created by p4j4r5 on 9/20/2024 in #đŸ™‹questions
RSA algorithim for /auth/exchange-code
Took a look at the link that is posted above. The conversations are mainly on username/password login, not using google oauth. I would like to use google oauth with chrome extension. I manage to get the ID_token from google oauth and using that ID_Token, i would like to exchange it to bearer JWT token so that same user is represented whether logged in from extenstion or from webpage.
23 replies