joschan21 / quill

Quill - A Modern SaaS-Platform Built With Next.js 13
1.91k stars 514 forks source link

Kinde Authentication Error #27

Open skoyyinc opened 1 year ago

skoyyinc commented 1 year ago

I was following along Josh's tutorial video when I noticed that when I tried to open the dashboard page when not authenticated, it redirected to a page that does not exist ("/sign-in") in the onError function. I edited the url to /api/auth/login and the redirect works fine, but somehow Kinde gives an error everytime I try to log in through redirection. When I try logging in via the front end ( LoginLink Component ) or if I typed the url in the browser, it works just fine.

onError: (err) => {
            if(err.data?.code === "UNAUTHORIZED") {
                router.push("/api/auth/login")  

            }
            // router.push("/sign-in")  

        },  

kinde_error

Is there anything I missed? could it be a problem in the Kinde side or the browser? Thanks

Rahul-jpeg commented 1 year ago

This seems to be an issue on the side of Kinde I think. I had a similar issue where if I try to login or logout using '/sign-in' or '/sign-out' in the Mobile navbar I either got authentication issue or I couldn't logout. Refer the pull request made by @ZeberMVP here. Following this solved my login and logout Kinde authentication issue

skoyyinc commented 1 year ago

@Rahul-jpeg Thanks