-
Notifications
You must be signed in to change notification settings - Fork 8
feat: nextauth v4に対応 #10
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
Changes from 4 commits
1f871a3
1ef4763
4db4132
19d8207
f6182f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 24.12.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,32 @@ | ||
| import NextAuth from 'next-auth'; | ||
| import { DefaultSession } from "next-auth"; | ||
| import { JWT } from "next-auth/jwt"; | ||
|
|
||
| declare module "next-auth" { | ||
| interface Session { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: この辺りの各種interfaceはどこで利用しているものでしょうか?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 使っているのは There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO: 分かりました。 |
||
| accessToken?: string; | ||
| } | ||
| } | ||
|
|
||
| declare module "next-auth" { | ||
| interface OAuthConfig { | ||
| scope?: string; | ||
| params: { | ||
| grant_type: 'string' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| declare module "next-auth" { | ||
| interface Profile { | ||
| id?: string; | ||
| scope?: string; | ||
| } | ||
| } | ||
|
|
||
| declare module "next-auth/jwt" { | ||
| interface JWT { | ||
| accessToken?: string; | ||
| } | ||
| } | ||
|
|
||
| declare module 'next-auth' {} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: JWTのtoken.idへの代入が消されていますが、これは不要になったのでしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.logで値を見ていたのですが、元からprofileにidは入っていなさそうだったので消しました。おそらく最初に実装していた際に、NextAuthのサンプルコードなどを参考にしていたのではないでしょうか?
ちなみにprofileに入りうるのは
{ data : CurrentUserSerializer, ... }のようなデータですThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
承知しました。確認ありがとうございます