-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
building/testing auth flow #142
Comments
(bug): Improper login page reloadAt the time, when
A forced page reload has to be made to see the changes. |
(bug): Update Many returns nullWhen the I couldn't understand the actual working of this functionality, so can you explain me just the rough flow of things taking place within this functionality? |
I think I fixed this in develop, but we lost power so I couldn't merge before I left. I'll send you the updated env tomorrow so you can work on the dev branch. |
This is expected behaviour, but a shoddy implementation by me. I was using data from I just commented out the code and set users to an empty array since the code is only for use locally. And errors if the import isn't valid. Although it is an admin route, so should return an error that you are not authorised. As I'm pretty sure I set |
(bug): Login creds & supabase authWhile logging in on the live website, some errors are being encountered: |
Ah yes the feedback needs to be updated. Check the supabase auth logs for more info on the error. You can also resend magic links from the auth tab in supabase. If the createError is an object convert it to a template literal for logging the error.message |
@aayu5hgit list all the bugs you're facing so I can help give you direction. |
(bug): Auth API ErrorWhen I tried to login NOTE: Scenario was tested when
|
OK, just had a quick look at the supabase logs and am seeing Which means we have a to test this theory I will add a new primary key and move the |
@aayu5hgit ok I have implemented the changes. I also added a trigger to watch the You will need to update the prisma endpoints to check the hopefully this resolves the errors, I'll leave the testing in your capable hands. |
@Drew-Macgibbon okay, so do I need to update the whole ‘prisma schema‘ too on the codebase? |
thought of an edge case, if the user updates their email, the CREATE OR REPLACE FUNCTION public.create_user_in_public() RETURNS TRIGGER AS $$
BEGIN
-- Update the row with NEW values if a corresponding row exists with OLD.id
UPDATE public.users SET auth_id = NEW.id, email = NEW.email WHERE auth_id = OLD.id;
-- Upsert logic (handles updates where the OLD.id wasn't found)
INSERT INTO public.users (auth_id, email)
VALUES (NEW.id, NEW.email)
ON CONFLICT (auth_id)
DO UPDATE SET email = excluded.email, auth_id = excluded.auth_id;
RETURN NEW;
END;
$$ LANGUAGE plpgsql; |
@Drew-Macgibbon after going through the above snippet, I think that in the INSERT INTO public.users (auth_id, email)
VALUES (NEW.id, NEW.email)
ON CONFLICT (auth_id)
DO UPDATE SET email = excluded.email; I might not be correct, but thought of discussing with you.😅 |
@aayu5hgit you're correct. Will update it. |
Drew-Macgibbon I tried updating the prisma endpoints to check the const user = await client.users.findFirst({
where: {
auth_id: id
},
include: {
roles: true
}
}) // Do I need to change this
const { id } = event.context.params
// To this
const authId = parseInt(req.params.auth_id)
// Or this
const { authId } = event.context.params |
@aayu5hgit it depends on where the I'll take a quick look at the code now and see if I can spot anything. Also, if you want help with errors make sure to post the error. I also reccomend copy pasting the error into chatGPT with some context for immediate help. |
@Drew-Macgibbon yes, I'll do the required and post things to maintain a record. Also, I did change the |
@aayu5hgit what is the error? I've tried to perform a clean npm i but the network keeps dropping, so not much I can do from my end. Maybe update the zod schemas if you haven't already.
id: z.number(),
auth_id: z.string().optional(), |
@Drew-Macgibbon not working, can you look into it? |
@Drew-Macgibbon Finally working, wohoo! auth.mp4I think there is a problem where the email that has already been verified is giving invalid credential error when passed the same in the |
Here we're building/testing/discussing the supabase auth flow.
This will be developed further in isolation here using a raw implementation of
supabase-js
because the nuxt module hides all of the logic and auth is a key part of our app that we need to understand.Flows handled:
The text was updated successfully, but these errors were encountered: