JLegendz
JLegendz
WWasp-lang
Created by JLegendz on 7/20/2024 in #🙋questions
Deployment Questions
Thanks for the response guys! I'm certainly getting close to the production milestone. I'm adding a few finishing touches, and then I need to create the production version of my stripe products, and finally integrate the stripe functionality into the mobile app. I'm using Wasp as my web app/ server, and using apis to power my mobile app. I'll be picking up dev again on Wednesday and I'll keep you all posted. I look forward to sharing in made-with-wasp when I get there. And yes I'll surely have a few questions along the way to get those finer details sorted. I appreciate the support.
9 replies
WWasp-lang
Created by fatima on 7/12/2024 in #🙋questions
Getting an error trying to get an existing wasp app started
31 replies
WWasp-lang
Created by fatima on 7/12/2024 in #🙋questions
Getting an error trying to get an existing wasp app started
Also, I’ll see if I can find it, but I asked a question awhile back about new entities not being recognized. It was because I had a ? on something that wasn’t supported. I’ll try to find the question.
31 replies
WWasp-lang
Created by fatima on 7/12/2024 in #🙋questions
Getting an error trying to get an existing wasp app started
Hi Fatima, I don’t think the bot can access files, but I’ve copied and pasted my code directly with success before.
31 replies
WWasp-lang
Created by Zuck on 6/12/2024 in #🙋questions
Can't redirect after action taken
No worries!
14 replies
WWasp-lang
Created by Zuck on 6/12/2024 in #🙋questions
Can't redirect after action taken
@Jacob Ferrari , hi, did you ever figure this out? I was going to suggest something along the lines of
await response.json().then(res => {
try {
history.push(res.redirectUrl);
} catch (err) {
console.log(err)
}
})
}
await response.json().then(res => {
try {
history.push(res.redirectUrl);
} catch (err) {
console.log(err)
}
})
}
I do something similar in my project. I think you just want to make sure the redirectUrl is ready, and THEN redirect. Just make sure you aren't redirecting prior to having the data. Hope you firgure it out!
14 replies
WWasp-lang
Created by JLegendz on 5/27/2024 in #🙋questions
New user fields not recognized
I was able to get it working. Thank you all. I’m at work atm, but I’ll look over the responses here in more detail when I get off.
40 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
Accessing API endpoing from postman
In postman I was trying to do a GET on localhost:3000 and nothing would work. I assumed because my app ran on that port in the browser.
14 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
Accessing API endpoing from postman
Hey, I think my confusion here was that my dev server ran at 3000. My api was at 3001.
14 replies
WWasp-lang
Created by JLegendz on 6/2/2024 in #🙋questions
Stripe event for onMonthlyContinuation of subscription?
I was able to handle my logic in the existing invoice.paid event. Thank you.
6 replies
WWasp-lang
Created by JLegendz on 5/31/2024 in #🙋questions
useQuery server side?
Sounds good. Thank you. I just placed a TODO in my code to come back to this when I could get a little help.
7 replies
WWasp-lang
Created by JLegendz on 5/30/2024 in #🙋questions
Safe to do major prisma update?
Sounds good!
8 replies
WWasp-lang
Created by JLegendz on 5/27/2024 in #🙋questions
New user fields not recognized
No worries. I was about to get it working. I think it was mainly #3 in my post.
40 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
All the back and forth is because when trying to match the passed in password to the hashed password with bcrypt, it never matched. I eventually realized that bcrypt was the wrong tool to test the hash with. My goal when I get back to my computer this evening is to try and generate that jwt with wasp. Is that process documented? I didn’t see it last I checked.
64 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
Honestly im a bit ignorant to the best approach at this, but I’m building a mobile version of my app as well, and I want to allow mobile users to log into the wasp app, which seems to mean I need to create a login api. That’s what all this is about. I was passing a username and password, with the intention of then generating a jwt in wasp and sending that, and a refresh token back to the mobile user.
64 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
Hi @martinsos , thank you so much for your reply, and I hope my use of Kapa isn’t a problem. It was very helpful although as you say, I might be going down the wrong path.
64 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
@kapa.ai I was able to successfully login using the following:
export const login = async (req: Request, res: Response) => {
const { email, password } = req.body;

const providerId = createProviderId('email', email);
const authIdentity = await findAuthIdentity(providerId);

if (!authIdentity) {
throw new HttpError(400, 'Unknown user');
}

const providerData = deserializeAndSanitizeProviderData(authIdentity.providerData) as EmailProviderData;

// Validate the password using argon2
try {
const passwordMatch = await argon2.verify(providerData.hashedPassword, password);
if (!passwordMatch) {
throw new HttpError(400, 'Incorrect password');
}
} catch (error) {
throw new HttpError(500, 'Error verifying password');
}



// Password is correct, proceed with authentication
res.json({ message: 'Login successful' });
};
export const login = async (req: Request, res: Response) => {
const { email, password } = req.body;

const providerId = createProviderId('email', email);
const authIdentity = await findAuthIdentity(providerId);

if (!authIdentity) {
throw new HttpError(400, 'Unknown user');
}

const providerData = deserializeAndSanitizeProviderData(authIdentity.providerData) as EmailProviderData;

// Validate the password using argon2
try {
const passwordMatch = await argon2.verify(providerData.hashedPassword, password);
if (!passwordMatch) {
throw new HttpError(400, 'Incorrect password');
}
} catch (error) {
throw new HttpError(500, 'Error verifying password');
}



// Password is correct, proceed with authentication
res.json({ message: 'Login successful' });
};
But now I need to return the appropriate jwt, how should that be done in WASP?
64 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
@kapa.ai I've made the suggested correction and findAuthIdentity now returns the user's provider data. However, now I get the following error:
[ Server ] POST /login 500 14.525 ms - 930
[ Server!] Error: hashBuf must be HASH_BYTES (128)
[ Server!] at assert (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/nanoassert/index.js:21:17)
[ Server!] at SecurePassword.verify (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:126:3)
[ Server!] at /home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:109:12
[ Server!] at new Promise (<anonymous>)
[ Server!] at SecurePassword.verify (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:108:12)
[ Server!] at login (/home/jparker/my_apps/sass_one/advertiser/app/src/apis.ts:34:48)
[ Server!] at <anonymous> (/home/jparker/my_apps/sass_one/advertiser/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
[ Server ] POST /login 500 14.525 ms - 930
[ Server!] Error: hashBuf must be HASH_BYTES (128)
[ Server!] at assert (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/nanoassert/index.js:21:17)
[ Server!] at SecurePassword.verify (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:126:3)
[ Server!] at /home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:109:12
[ Server!] at new Promise (<anonymous>)
[ Server!] at SecurePassword.verify (/home/jparker/my_apps/sass_one/advertiser/app/node_modules/secure-password/index.js:108:12)
[ Server!] at login (/home/jparker/my_apps/sass_one/advertiser/app/src/apis.ts:34:48)
[ Server!] at <anonymous> (/home/jparker/my_apps/sass_one/advertiser/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
64 replies
WWasp-lang
Created by JLegendz on 5/28/2024 in #🙋questions
API Authentication
@kapa.ai unfortunately findAuthIdentity always returns null, even when passed the username that I know exists
64 replies