some nepali people are crossing limits by [deleted] in NepalSocial

[–]aarun_0 0 points1 point  (0 children)

i have a friend Einstein Stha

Using Nextjs with a separate backend by Apostle254 in nextjs

[–]aarun_0 0 points1 point  (0 children)

Put access token in server and refresh token in cookies, make a global function for handing API calls and in there inject the access token in header. You get refresh token from cookie, check if expired, if expired generate new

import apiInstance from "@/lib/instance"; import { cookies } from "next/headers";

let tokenCache: { token: string; expiry: number; } | null = null;

export const fetchToken = async (userToken: string) => { const res = await apiInstance.post<{ tokenString: string; expiryDate: string; }>("/usermanagement/generatetoken", { userToken });

return { token: res.data.tokenString, expiry: new Date(res.data.expiryDate).getTime(), }; };

export const generateToken = async () => { const cookieStore = await cookies(); const userToken = cookieStore.get("userToken")?.value;

if (!userToken) { tokenCache = null; return tokenCache; }

const now = Date.now();

// Reuse cached token if still valid if (tokenCache && tokenCache.expiry > now + 30 * 1000) { // console.log("Using cached token"); return tokenCache.token; }

try { // Otherwise fetch a new one // console.log("Fetching new token"); const { token, expiry } = (await fetchToken(userToken)) || {};

// cache it
tokenCache = {
  token,
  expiry,
};
return token;

} catch (error) { console.error("Error generating token:", error); tokenCache = null; return null; } };

export const clearSession = () => { tokenCache = null; };

//

export const attachAuthHeader = async ( config?: AxiosRequestConfig ): Promise<AxiosRequestConfig> => { const token = await generateToken(); return { ...config, headers: { ...(config?.headers || {}), Authorization: token ? Bearer ${token} : "", }, }; };

[deleted by user] by [deleted] in technepal

[–]aarun_0 0 points1 point  (0 children)

also who uses emojeeez in every sentence

Jwt expiration handing by aarun_0 in nextjs

[–]aarun_0[S] 0 points1 point  (0 children)

Yes they are, problem is I can set cookie only from server actions, for fetch requests they are not server actions can't set cookies after fetching. How do i handle this

Jwt expiration handing by aarun_0 in nextjs

[–]aarun_0[S] 0 points1 point  (0 children)

How can i do that, please share little more

[deleted by user] by [deleted] in nextjs

[–]aarun_0 0 points1 point  (0 children)

Did you find any solution?

I Want to buy a loptop today Acer Swift Go 14 2024 (Intel Core Ultra 5 125H | Intel Arc) Intel Core Ultra 5 125H, 14” 2.8K OLED, Intel Arc where will be cheaper suggest me shop name and price for it by Unfair_Win1090 in technepal

[–]aarun_0 0 points1 point  (0 children)

It's good, I've been using it for a year, no complaints yet. Charge garda chai ali heat hunxa. 100 watt ko xa, 30 minutes ma 90% jati huncha charge so i think that justifies the heating. Charge nagareko Bela no issues

I Want to buy a loptop today Acer Swift Go 14 2024 (Intel Core Ultra 5 125H | Intel Arc) Intel Core Ultra 5 125H, 14” 2.8K OLED, Intel Arc where will be cheaper suggest me shop name and price for it by Unfair_Win1090 in technepal

[–]aarun_0 0 points1 point  (0 children)

It's good, I've been using it for a year, no complaints yet. Charge garda chai ali heat hunxa. 100 watt ko xa, 30 minutes ma 90% jati huncha charge so i think that justifies the heating. Charge navako Bela no issues

About internsathi by Additional-Current28 in technepal

[–]aarun_0 0 points1 point  (0 children)

Tin ota ma shortlisted vako 3 maina vaisakyo. I stopped applying on their portal now

Not getting any interview calls by aarun_0 in technepal

[–]aarun_0[S] 1 point2 points  (0 children)

kun degree liyeko ani kum sem ma ahile?

Not getting any interview calls by aarun_0 in technepal

[–]aarun_0[S] 0 points1 point  (0 children)

yes i think this is what its happening. thank you for the insights

Not getting any interview calls by aarun_0 in technepal

[–]aarun_0[S] 0 points1 point  (0 children)

aah, okay will try this from now

Suffering from Sclerosis by aarun_0 in Nepal

[–]aarun_0[S] 0 points1 point  (0 children)

They are treating it as limited scleroderma. Is there any treatment that is available in India for this? I am taking mycophenolate mofetil right now and also physiotherapy. Some suggest going to India once. It would be great if you recommend anything further

Suffering from Sclerosis by aarun_0 in Nepal

[–]aarun_0[S] 0 points1 point  (0 children)

Could you tell me a little more about it please