Skip to content
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

Improve typescript implemntation of the implemented AuthOptions. #3

Open
nikolaischunk opened this issue Jul 13, 2023 · 1 comment
Open

Comments

@nikolaischunk
Copy link

nikolaischunk commented Jul 13, 2023

Topic

The whole repository serves as a great starting point for creating a dashboard in combination with a bot.
Since this repo serves as a template, it would awesome if the implementation of the auth would be correctly typesafed.

This File

NextAuth provides a way to augment the different interfaced, that are used, like Session.

https://next-auth.js.org/getting-started/typescript#module-augmentation

Own Implementation

I used this to augment the session user field, but am stuck, when it comes to the profile, jwt etc types

https://github.com/BirthdayyBot/dashboard/blob/develop/src/lib/types/next-auth.d.ts
https://github.com/BirthdayyBot/dashboard/blob/develop/src/lib/options/auth.ts

If this is successful, it would be something that never has been documented (afaik), so pretty useful.

Related Links

nextauthjs/next-auth#3774
https://github.com/analog-org/analog-tsx/blob/master/apps/dashboard/src/pages/api/auth/%5B...nextauth%5D.ts
https://authjs.dev/getting-started/typescript
https://next-auth.js.org/configuration/callbacks#session-callback
nextauthjs/next-auth#614

@BossDaily
Copy link
Member

Sorry for taking forever, I was in Kenya when you submitted this. I am also facing this dilemma with the profile types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants