Skip to content

Commit

Permalink
Add Discord and Slack OAuth providers (#876)
Browse files Browse the repository at this point in the history
* Add new oauth providers to auth-core consts
* Expose `authToken` on session object in auth-nextjs
  • Loading branch information
jaclarke committed Feb 23, 2024
1 parent c1fa6d5 commit 18f0351
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/auth-core/src/consts.ts
Expand Up @@ -3,8 +3,10 @@
export const builtinOAuthProviderNames = [
"builtin::oauth_apple",
"builtin::oauth_azure",
"builtin::oauth_discord",
"builtin::oauth_github",
"builtin::oauth_google",
"builtin::oauth_slack",
] as const;
export type BuiltinOAuthProviderNames =
(typeof builtinOAuthProviderNames)[number];
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-nextjs/src/app/index.ts
Expand Up @@ -25,7 +25,7 @@ export class NextAppAuth extends NextAuth {
() =>
new NextAuthSession(
this.client,
cookies().get(this.options.authCookieName)?.value.split(";")[0]
cookies().get(this.options.authCookieName)?.value.split(";")[0] ?? null
)
);

Expand Down
2 changes: 1 addition & 1 deletion packages/auth-nextjs/src/pages/server.ts
Expand Up @@ -35,7 +35,7 @@ export class NextPagesAuth extends NextAuth {
sessionCache.get(req) ??
new NextAuthSession(
this.client,
req.cookies[this.options.authCookieName]?.split(";")[0]
req.cookies[this.options.authCookieName]?.split(";")[0] ?? null
);
sessionCache.set(req, session);
return session;
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-nextjs/src/shared.ts
Expand Up @@ -519,7 +519,7 @@ export class NextAuthSession {
public readonly client: Client;

/** @internal */
constructor(client: Client, private readonly authToken: string | undefined) {
constructor(client: Client, public readonly authToken: string | null) {
this.client = this.authToken
? client.withGlobals({ "ext::auth::client_token": this.authToken })
: client;
Expand Down

0 comments on commit 18f0351

Please sign in to comment.