hasancanbuyukask3180
12/27/2023, 9:35 AMrp_st
12/27/2023, 9:36 AMhasancanbuyukask3180
12/27/2023, 9:38 AMrp_st
12/27/2023, 9:47 AMhasancanbuyukask3180
12/27/2023, 11:44 AMhasancanbuyukask3180
12/27/2023, 11:44 AMhasancanbuyukask3180
12/27/2023, 11:50 AMhasancanbuyukask3180
12/27/2023, 11:50 AMrp_st
12/27/2023, 11:52 AMrp_st
12/27/2023, 11:56 AMgetSSRSession, we need to correct the value we set for hasToken. Instead of doing hasToken: err.type !== Session.Error.UNAUTHORISED, it should be hasToken: parsedCookies["sAccessToken] !== undefined
And when you use getSSRSession, if !session && hasToken, then you want to render the <TryRefreshComponent /> instead of redirecting to the auth page (as shown here: https://supertokens.com/docs/thirdpartyemailpassword/nextjs/app-directory/protecting-route#modify-home-page-to-check-for-sessions--cust)rp_st
12/27/2023, 11:59 AMrp_st
12/27/2023, 12:03 PMTryRefreshComponent, it will try and do a refresh and realise that there is no session and then also clear the frontend state indicating a session doesn't exit and then when it redirects to the auth page, it will stay there.hasancanbuyukask3180
12/27/2023, 12:12 PMrp_st
12/27/2023, 12:12 PMrp_st
12/27/2023, 12:13 PMTryRefreshComponent.hasancanbuyukask3180
12/27/2023, 12:18 PMhasancanbuyukask3180
12/27/2023, 12:18 PMrp_st
12/27/2023, 12:20 PMrp_st
12/27/2023, 12:20 PMhasancanbuyukask3180
12/27/2023, 12:22 PMhasancanbuyukask3180
12/27/2023, 12:22 PMrp_st
12/27/2023, 12:23 PMrp_st
12/27/2023, 12:24 PMhasToken is true and session is undefinedhasancanbuyukask3180
12/27/2023, 12:24 PMrp_st
12/27/2023, 12:24 PMhasToken is false and session is undefined, you want to redirect to the /auth pagehasancanbuyukask3180
12/27/2023, 12:25 PMrp_st
12/27/2023, 12:25 PM/hasan, you want to just render the component and not do a session check. So in the middleware, you have to make an exception for if the current path is /hasan, you don't do getSSRTokenrp_st
12/27/2023, 12:26 PM/auth/* routes - you don't want to call getSSRToken for those routes in the middleware.hasancanbuyukask3180
12/27/2023, 12:27 PMrp_st
12/27/2023, 12:28 PMhasancanbuyukask3180
12/27/2023, 12:30 PMhasancanbuyukask3180
12/27/2023, 12:32 PMrp_st
12/27/2023, 12:32 PMhasancanbuyukask3180
12/27/2023, 12:34 PMrp_st
12/27/2023, 12:35 PMhasancanbuyukask3180
12/27/2023, 12:48 PMhasancanbuyukask3180
12/27/2023, 12:51 PMrp_st
12/27/2023, 12:51 PMrp_st
12/27/2023, 12:52 PM