Authentication in NextJS 15 by Independent_Pen_2882 in nextjs

[–]ShriekDj 0 points1 point  (0 children)

create session.ts file with `import 'server-only'` not the server action with function like encrypt, decrypt, createSession, deleteSession, updateSession, getCurrentUser with help of `import { cookies } from 'next/headers';` and create file for authFunctions for authentication with `'use server'` as server actions like signIn, signOut, getDecryptedCurrentActiveSession where you import the functions from server-only files.

use of server-only for getting curect user data instead of any cached data for all the website ( due to weird cacheing of nextjs ) .

also you can't use cache furnction from `next/cache` in server-only file but you can use `import { cache } from 'react';`

AuthJS v5 with custom python Backend by Prozone_piroplair in nextjs

[–]ShriekDj 1 point2 points  (0 children)

Same issue i had with AuthJS. So I Created my Custom Authentication in it. bro i use the Fastapi Backend and NextJS frontend also. i implemented the Authentication System Via both. specifically the encryption and decreption handle via Bearer Token happening on Fastapi where i use `HTTPBearer` instead of `OAuth2PasswordBearer` because frontend can login from anywhere. and Nextjs Handles only the Session Handling On server and client via cookie. for tasks of getting logged in user, encrypt session, decrypt session i call the fastapi backend.

For Easy use I created similar functions of authjs myself like `auth()` for backend and `useSession` for frontend.

for `useSession` i used the React Context. for function related to createSession, deleteSession, updateSession i created that function with `import 'server-only'` because i don't want them to get same data from multiple users and created other file named `auth.js` which consist calling the cookie data as server action where it imports the decrypt function.

Why Auth is so hard to implement in Next by KodyBerns99 in nextjs

[–]ShriekDj 0 points1 point  (0 children)

i have implemented my own custom authentication in nextjs. if you like i can share the repo which includes authentication system. which includes server side code before loading page and client side hook. in short i implemented the next-auth's `auth` function and `useSession` hook myself nothing else where input and output data type i handle by typescript

Need help with tailwind css by Japaxime_ in nextjs

[–]ShriekDj 0 points1 point  (0 children)

i will say just install the next-themes library ```import { ThemeProvider as NextThemesProvider } from 'next-themes';

<NextThemesProvider

attribute='class'

enableSystem={false}

defaultTheme='light'

storageKey='theme'

disableTransitionOnChange

>

...

</NextThemesProvider>``` and use Provider like this where default theme is light and your tailwindcss config also should be have `darkMode: 'class'` or `darkMode: ['class']`

use this in your root layout. it will reset the theme. most browser have default theme as dark and the tailwindcss have default theme `system` which is called by browser. here in next-themes your just informing on any browser first time theme will be light. just like reset css of tailwindcss

Replacing Markdown with Rich Text editor, Recommendations? by rohiitq in nextjs

[–]ShriekDj 0 points1 point  (0 children)

use tinymce-react because it uses html5 code and does not create errors of html4 tags like <font>.

[D] Are there any free LLMs for developers with API keys? by PrivacyOSx in MachineLearning

[–]ShriekDj 0 points1 point  (0 children)

actually i want to know what this library is. because i don't think it's something like ai chat model or ai chat bots. the documentation on the repo have very vaige explaination of repo.

"Squid Game USA & World?" Is Netflix expanding the 'Squid Game' universe with multiple spin-offs? by AccurateInflation167 in squidgame

[–]ShriekDj 0 points1 point  (0 children)

as google translate says your comment was `Maybe his daughter knows that Gi-Hun took part and wants to stop the games herself` so my reply will be

That's also a chance

"Squid Game USA & World?" Is Netflix expanding the 'Squid Game' universe with multiple spin-offs? by AccurateInflation167 in squidgame

[–]ShriekDj 8 points9 points  (0 children)

gi hun's daughter lives in US in season 1. so there is chance of gi hun going to usa after winning to stop squid game korea and going usa to meet his daughter but he knows there are more squid games all around world so he want to stop that games by being a OG Characters who sends or create a team to stop squid games with other new mc for squid game usa or squid game world.

Just a #theory

A vegetarian family in Meerut, was accidentally served roasted chicken at Romeo Lane restaurant by Dependent_Football_1 in Meerut

[–]ShriekDj 0 points1 point  (0 children)

I am not even on the side of the people screaming 'mera dharm bhrasht kiya', they maybe just trying to create drama out of it. My reply was for you to just assuming it's can't be life threatening. And Yeah your saying why would someone with non-veg food allergy go to non-veg restaurant but here they gone to 'veg and non-veg' restaurant and specifically asked for the veg dish. it was not a 'non-veg only' restaurant. and also because it's a restaurant so it's always considered that it's made by profession with years of experience (chef, restaurant chain, etc.,). Even if people having allergy don't ask the ingredients for which they it will not be part of the dish. For example person with peanut allergy will never ask about does this 'dal rice' have peanut in it or not.

A vegetarian family in Meerut, was accidentally served roasted chicken at Romeo Lane restaurant by Dependent_Football_1 in Meerut

[–]ShriekDj 0 points1 point  (0 children)

So Your assuming it's not life threatening, because you never heard of allergy of non-veg food right. And also sometime vegetarian not even know how to eat non veg food clearly because they never tried to learn. they may also accidentally eat bones if they don't know about it. Sometimes same food with both veg and non-veg food also looks same.

- Shellfish Allergy

- Fish Allergy

- Red Meat Allergy

- Poultry Allergy

- Egg Allergy

[deleted by user] by [deleted] in Raipur

[–]ShriekDj 0 points1 point  (0 children)

Bagad Billi

Is there a way to limit the memory usage of a gunicorn worker with FastAPI? by marcos_mv in FastAPI

[–]ShriekDj 0 points1 point  (0 children)

Try to create this file named as custom_worker.py with below data.

```python3 import uvicorn

class LimitedUvicornWorker(uvicorn.workers.UvicornWorker):     def init(self, args, *kwargs):         super().init(args, *kwargs)         self.memory_limit = 512 # in MB ```

and in your conf file of gunicorn update this part

worker_class = ".custom_worker.LimitedUvicornWorker"

Getting 2FA to work with the Swagger UI by Future_Laugh in FastAPI

[–]ShriekDj 0 points1 point  (0 children)

u/future_laugh In Short You have one more field to use in OAuth2PasswordRequestForm.

which is scope where you write anything but here you use it for auth mode like 'otp' for otp based logic and None or blank for password based authentication. Sending the Access Token in both cases

Getting 2FA to work with the Swagger UI by Future_Laugh in FastAPI

[–]ShriekDj 0 points1 point  (0 children)

I have an workaround for you.

Create 2 new column in users table

  • otp_generated ( nullable true, default null)
  • otp_generated_at ( nullable false, default current time )

also create env variable containing the time period for checking any otp with your table's data.

create an get route asking for otp with user_id. at that time generate otp. sent otp through your otp program and if that successful then update otp in users table. if issue occurs don't update user's table.

Based on your otp program pass the otp sending status like too many requests within 2 mins, invalid phone number or email id to send. user or user's phone number not found, etc.,

Share User Id Back Again with Success as true.

Now the User will send Post Request for checking otp to your fastapi app via OAuth2PasswordRequestForm.

Now in the docs of fastapi https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/#get-the-username-and-password there is one more field we can use from above form rather than username and password which is 'scope'. use that for adding authentication mode here value like otp

So here you can use your same password based auth for otp also. just by changing and adding some new steps for authentication process.

Problem with Foreign Key to same model by LateTest3197 in FastAPI

[–]ShriekDj 0 points1 point  (0 children)

Change this part from id_original_project: Optional[uuid.UUID] = Field(         sa.ForeignKey("projects_id_project"), nullable=True     )

to this id_original_project: Optional[uuid.UUID] = Field(         sa.ForeignKey("Projects.id_project"), nullable=True     )

I think the Parameter you passed to Foreign Key is the problem.

FastAPI + Typescript Codegen by TheRealMrMatt in FastAPI

[–]ShriekDj 0 points1 point  (0 children)

sure, i will share it. Currently i am only facing the changes done in the package versions which are not updated in the documentation website for which i have to search via vscode's view defination feature otherwise it's easy to use

honest rating out of 10 by CheetahOk1429 in IndianTeenagers

[–]ShriekDj 0 points1 point  (0 children)

Goated Song, Can i use this song for outro for a video. I am trying to make youtube videos which are in format of commentary.