mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
3 Commits
@auth/core
...
@auth/core
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6ac48314e | ||
|
|
f8675bc245 | ||
|
|
3d4842dcc9 |
@@ -4,11 +4,8 @@ import * as github from "@actions/github"
|
||||
// @ts-expect-error
|
||||
import * as core from "@actions/core"
|
||||
import { readFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
|
||||
const addReproductionLabel = "incomplete"
|
||||
const __dirname =
|
||||
"/home/runner/work/nextauthjs/next-auth/.github/actions/issue-validator"
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
@@ -73,7 +70,7 @@ async function run() {
|
||||
}),
|
||||
client.issues.createComment({
|
||||
...issueCommon,
|
||||
body: readFileSync(join(__dirname, "repro.md"), "utf8"),
|
||||
body: readFileSync("repro.md", "utf8"),
|
||||
}),
|
||||
])
|
||||
return core.info(
|
||||
|
||||
@@ -72,4 +72,4 @@
|
||||
"postcss": "8.4.19",
|
||||
"postcss-nested": "6.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Account, Awaitable, User } from "."
|
||||
import type { Account, Awaitable, User } from "./index.js"
|
||||
|
||||
export interface AdapterUser extends User {
|
||||
id: string
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { init } from "./lib/init"
|
||||
import { assertConfig } from "./lib/assert"
|
||||
import { SessionStore } from "./lib/cookie"
|
||||
import { toInternalRequest, toResponse } from "./lib/web"
|
||||
import renderPage from "./lib/pages"
|
||||
import * as routes from "./lib/routes"
|
||||
import logger, { setLogger } from "./lib/utils/logger"
|
||||
import { init } from "./lib/init.js"
|
||||
import { assertConfig } from "./lib/assert.js"
|
||||
import { SessionStore } from "./lib/cookie.js"
|
||||
import { toInternalRequest, toResponse } from "./lib/web.js"
|
||||
import renderPage from "./lib/pages/index.js"
|
||||
import * as routes from "./lib/routes/index.js"
|
||||
import logger, { setLogger } from "./lib/utils/logger.js"
|
||||
|
||||
import type { ErrorType } from "./lib/pages/error"
|
||||
import type { ErrorType } from "./lib/pages/error.js"
|
||||
import type {
|
||||
AuthOptions,
|
||||
RequestInternal,
|
||||
ResponseInternal,
|
||||
} from "./lib/types"
|
||||
import { UntrustedHost } from "./lib/errors"
|
||||
} from "./lib/types.js"
|
||||
import { UntrustedHost } from "./lib/errors.js"
|
||||
|
||||
export * from "./lib/types"
|
||||
export * from "./lib/types.js"
|
||||
|
||||
const configErrorMessage =
|
||||
"There is a problem with the server configuration. Check the server logs for more information."
|
||||
@@ -35,7 +35,7 @@ async function AuthHandlerInternal<
|
||||
assertionResult.forEach(logger.warn)
|
||||
} else if (assertionResult instanceof Error) {
|
||||
// Bail out early if there's an error in the user config
|
||||
logger.error(assertionResult.code, assertionResult)
|
||||
logger.error((assertionResult as any).code, assertionResult)
|
||||
|
||||
const htmlPages = ["signin", "signout", "error", "verify-request"]
|
||||
if (!htmlPages.includes(req.action) || req.method !== "GET") {
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { EncryptJWT, jwtDecrypt } from "jose"
|
||||
import hkdf from "@panva/hkdf"
|
||||
import { SessionStore } from "../lib/cookie"
|
||||
import type { JWT, JWTDecodeParams, JWTEncodeParams, JWTOptions } from "./types"
|
||||
import type { LoggerInstance } from ".."
|
||||
import { hkdf } from "@panva/hkdf"
|
||||
import { SessionStore } from "../lib/cookie.js"
|
||||
import type {
|
||||
JWT,
|
||||
JWTDecodeParams,
|
||||
JWTEncodeParams,
|
||||
JWTOptions,
|
||||
} from "./types.js"
|
||||
import type { LoggerInstance } from "../index.js"
|
||||
|
||||
export * from "./types"
|
||||
export * from "./types.js"
|
||||
|
||||
const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60 // 30 days
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Awaitable } from ".."
|
||||
import type { Awaitable } from "../index.js"
|
||||
|
||||
export interface DefaultJWT extends Record<string, unknown> {
|
||||
name?: string | null
|
||||
|
||||
@@ -7,11 +7,11 @@ import {
|
||||
MissingAuthorize,
|
||||
MissingSecret,
|
||||
UnsupportedStrategy,
|
||||
} from "./errors"
|
||||
import { defaultCookies } from "./cookie"
|
||||
} from "./errors.js"
|
||||
import { defaultCookies } from "./cookie.js"
|
||||
|
||||
import type { AuthOptions, RequestInternal } from ".."
|
||||
import type { WarningCode } from "./utils/logger"
|
||||
import type { AuthOptions, RequestInternal } from "../index.js"
|
||||
import type { WarningCode } from "./utils/logger.js"
|
||||
|
||||
type ConfigError =
|
||||
| MissingAdapter
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { AccountNotLinkedError } from "./errors"
|
||||
import { fromDate } from "./utils/date"
|
||||
import { AccountNotLinkedError } from "./errors.js"
|
||||
import { fromDate } from "./utils/date.js"
|
||||
|
||||
import type { Account, InternalOptions, User } from ".."
|
||||
import type { AdapterSession, AdapterUser } from "../adapters"
|
||||
import type { JWT } from "../jwt"
|
||||
import type { OAuthConfig } from "../providers"
|
||||
import type { SessionToken } from "./cookie"
|
||||
import type { Account, InternalOptions, User } from "../index.js"
|
||||
import type { AdapterSession, AdapterUser } from "../adapters.js"
|
||||
import type { JWT } from "../jwt/index.js"
|
||||
import type { OAuthConfig } from "../providers/index.js"
|
||||
import type { SessionToken } from "./cookie.js"
|
||||
|
||||
/**
|
||||
* This function handles the complex flow of signing users in, and either creating,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InternalOptions } from ".."
|
||||
import type { InternalOptions } from "../index.js"
|
||||
|
||||
interface CreateCallbackUrlParams {
|
||||
options: InternalOptions
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
CookiesOptions,
|
||||
LoggerInstance,
|
||||
SessionStrategy,
|
||||
} from ".."
|
||||
} from "../index.js"
|
||||
|
||||
// Uncomment to recalculate the estimated size
|
||||
// of an empty session cookie
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createHash, randomString } from "./web"
|
||||
import type { InternalOptions } from "./types"
|
||||
import { createHash, randomString } from "./web.js"
|
||||
import type { InternalOptions } from "./types.js"
|
||||
|
||||
interface CreateCSRFTokenParams {
|
||||
options: InternalOptions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CallbacksOptions } from ".."
|
||||
import type { CallbacksOptions } from "../index.js"
|
||||
|
||||
export const defaultCallbacks: CallbacksOptions = {
|
||||
signIn() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AdapterUser } from "../../adapters"
|
||||
import type { InternalOptions } from "../.."
|
||||
import type { AdapterUser } from "../../adapters.js"
|
||||
import type { InternalOptions } from "../../index.js"
|
||||
|
||||
/**
|
||||
* Query the database for a user by email address.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { randomString, createHash } from "../web"
|
||||
import type { InternalOptions } from "../.."
|
||||
import { randomString, createHash } from "../web.js"
|
||||
import type { InternalOptions } from "../../index.js"
|
||||
|
||||
/**
|
||||
* Starts an e-mail login flow, by generating a token,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { EventCallbacks, LoggerInstance } from "./types"
|
||||
import type { EventCallbacks, LoggerInstance } from "./types.js"
|
||||
|
||||
/**
|
||||
* Same as the default `Error`, but it is JSON serializable.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { adapterErrorHandler, eventsErrorHandler } from "./errors"
|
||||
import * as jwt from "../jwt"
|
||||
import { createCallbackUrl } from "./callback-url"
|
||||
import * as cookie from "./cookie"
|
||||
import { createCSRFToken } from "./csrf-token"
|
||||
import { defaultCallbacks } from "./default-callbacks"
|
||||
import parseProviders from "./providers"
|
||||
import logger from "./utils/logger"
|
||||
import parseUrl from "./utils/parse-url"
|
||||
import { adapterErrorHandler, eventsErrorHandler } from "./errors.js"
|
||||
import * as jwt from "../jwt/index.js"
|
||||
import { createCallbackUrl } from "./callback-url.js"
|
||||
import * as cookie from "./cookie.js"
|
||||
import { createCSRFToken } from "./csrf-token.js"
|
||||
import { defaultCallbacks } from "./default-callbacks.js"
|
||||
import parseProviders from "./providers.js"
|
||||
import logger from "./utils/logger.js"
|
||||
import parseUrl from "./utils/parse-url.js"
|
||||
|
||||
import type { AuthOptions, InternalOptions, RequestInternal } from ".."
|
||||
import type { AuthOptions, InternalOptions, RequestInternal } from "../index.js"
|
||||
|
||||
interface InitParams {
|
||||
url: URL
|
||||
|
||||
@@ -5,8 +5,8 @@ import type {
|
||||
InternalOptions,
|
||||
RequestInternal,
|
||||
ResponseInternal,
|
||||
} from "../.."
|
||||
import type { Cookie } from "../cookie"
|
||||
} from "../../index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
|
||||
/**
|
||||
* Generates an authorization/request token URL.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { OAuthCallbackError } from "../errors"
|
||||
import { useNonce } from "./nonce-handler"
|
||||
import { usePKCECodeVerifier } from "./pkce-handler"
|
||||
import { useState } from "./state-handler"
|
||||
import { OAuthCallbackError } from "../errors.js"
|
||||
import { useNonce } from "./nonce-handler.js"
|
||||
import { usePKCECodeVerifier } from "./pkce-handler.js"
|
||||
import { useState } from "./state-handler.js"
|
||||
import * as o from "oauth4webapi"
|
||||
|
||||
import type {
|
||||
@@ -10,9 +10,9 @@ import type {
|
||||
Profile,
|
||||
RequestInternal,
|
||||
TokenSet,
|
||||
} from "../.."
|
||||
import type { OAuthConfigInternal } from "../../providers"
|
||||
import type { Cookie } from "../cookie"
|
||||
} from "../../index.js"
|
||||
import type { OAuthConfigInternal } from "../../providers/index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
|
||||
export async function handleOAuthCallback(params: {
|
||||
options: InternalOptions<"oauth">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as o from "oauth4webapi"
|
||||
import * as jwt from "../../jwt"
|
||||
import * as jwt from "../../jwt/index.js"
|
||||
|
||||
import type { InternalOptions } from "../.."
|
||||
import type { Cookie } from "../cookie"
|
||||
import type { InternalOptions } from "../../index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
|
||||
const NONCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as o from "oauth4webapi"
|
||||
import * as jwt from "../../jwt"
|
||||
import * as jwt from "../../jwt/index.js"
|
||||
|
||||
import type { InternalOptions } from "../.."
|
||||
import type { Cookie } from "../cookie"
|
||||
import type { InternalOptions } from "../../index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
|
||||
const PKCE_CODE_CHALLENGE_METHOD = "S256"
|
||||
const PKCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { InternalOptions } from "../.."
|
||||
import type { Cookie } from "../cookie"
|
||||
import type { InternalOptions } from "../../index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
import * as o from "oauth4webapi"
|
||||
|
||||
const STATE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Theme } from "../.."
|
||||
import type { Theme } from "../../index.js"
|
||||
|
||||
/**
|
||||
* The following errors are passed as error query parameters to the default or overridden error page.
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import renderToString from "preact-render-to-string"
|
||||
import css from "../styles"
|
||||
import ErrorPage from "./error"
|
||||
import SigninPage from "./signin"
|
||||
import SignoutPage from "./signout"
|
||||
import VerifyRequestPage from "./verify-request"
|
||||
import { renderToString } from "preact-render-to-string"
|
||||
import css from "../styles/index.js"
|
||||
import ErrorPage from "./error.js"
|
||||
import SigninPage from "./signin.js"
|
||||
import SignoutPage from "./signout.js"
|
||||
import VerifyRequestPage from "./verify-request.js"
|
||||
|
||||
import type { InternalOptions, RequestInternal, ResponseInternal } from "../.."
|
||||
import type { Cookie } from "../cookie"
|
||||
import type { ErrorType } from "./error"
|
||||
import type {
|
||||
InternalOptions,
|
||||
RequestInternal,
|
||||
ResponseInternal,
|
||||
} from "../../index.js"
|
||||
import type { Cookie } from "../cookie.js"
|
||||
import type { ErrorType } from "./error.js"
|
||||
|
||||
type RenderPageParams = {
|
||||
query?: RequestInternal["query"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InternalProvider, Theme } from "../.."
|
||||
import type { InternalProvider, Theme } from "../../index.js"
|
||||
|
||||
/**
|
||||
* The following errors are passed as error query parameters to the default or overridden sign-in page.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Theme } from "../.."
|
||||
import type { Theme } from "../../index.js"
|
||||
|
||||
export interface SignoutProps {
|
||||
url: URL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Theme } from "../.."
|
||||
import type { Theme } from "../../index.js"
|
||||
|
||||
interface VerifyRequestPageProps {
|
||||
url: URL
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { merge } from "./utils/merge"
|
||||
import { merge } from "./utils/merge.js"
|
||||
|
||||
import type { InternalProvider } from ".."
|
||||
import type { InternalProvider } from "../index.js"
|
||||
import type {
|
||||
OAuthConfig,
|
||||
OAuthConfigInternal,
|
||||
OAuthEndpointType,
|
||||
OAuthUserConfig,
|
||||
Provider,
|
||||
} from "../providers"
|
||||
} from "../providers/index.js"
|
||||
|
||||
/**
|
||||
* Adds `signinUrl` and `callbackUrl` to each provider
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import callbackHandler from "../callback-handler"
|
||||
import getAdapterUserFromEmail from "../email/getUserFromEmail"
|
||||
import { handleOAuthCallback } from "../oauth/callback"
|
||||
import { createHash } from "../web"
|
||||
import callbackHandler from "../callback-handler.js"
|
||||
import getAdapterUserFromEmail from "../email/getUserFromEmail.js"
|
||||
import { handleOAuthCallback } from "../oauth/callback.js"
|
||||
import { createHash } from "../web.js"
|
||||
|
||||
import type { RequestInternal, ResponseInternal, User } from "../.."
|
||||
import type { AdapterSession } from "../../adapters"
|
||||
import type { Cookie, SessionStore } from "../cookie"
|
||||
import type { InternalOptions } from "../types"
|
||||
import type { RequestInternal, ResponseInternal, User } from "../../index.js"
|
||||
import type { AdapterSession } from "../../adapters.js"
|
||||
import type { Cookie, SessionStore } from "../cookie.js"
|
||||
import type { InternalOptions } from "../types.js"
|
||||
|
||||
/** Handle callbacks from login services */
|
||||
export async function callback(params: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export { callback } from "./callback"
|
||||
export { providers } from "./providers"
|
||||
export { session } from "./session"
|
||||
export { signin } from "./signin"
|
||||
export { signout } from "./signout"
|
||||
export { callback } from "./callback.js"
|
||||
export { providers } from "./providers.js"
|
||||
export { session } from "./session.js"
|
||||
export { signin } from "./signin.js"
|
||||
export { signout } from "./signout.js"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InternalProvider, ResponseInternal } from "../.."
|
||||
import type { InternalProvider, ResponseInternal } from "../../index.js"
|
||||
|
||||
export interface PublicProvider {
|
||||
id: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { fromDate } from "../utils/date"
|
||||
import { fromDate } from "../utils/date.js"
|
||||
|
||||
import type { InternalOptions, ResponseInternal, Session } from "../.."
|
||||
import type { Adapter } from "../../adapters"
|
||||
import type { SessionStore } from "../cookie"
|
||||
import type { InternalOptions, ResponseInternal, Session } from "../../index.js"
|
||||
import type { Adapter } from "../../adapters.js"
|
||||
import type { SessionStore } from "../cookie.js"
|
||||
|
||||
interface SessionParams {
|
||||
options: InternalOptions
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import getAdapterUserFromEmail from "../email/getUserFromEmail"
|
||||
import emailSignin from "../email/signin"
|
||||
import { getAuthorizationUrl } from "../oauth/authorization-url"
|
||||
import getAdapterUserFromEmail from "../email/getUserFromEmail.js"
|
||||
import emailSignin from "../email/signin.js"
|
||||
import { getAuthorizationUrl } from "../oauth/authorization-url.js"
|
||||
|
||||
import type {
|
||||
Account,
|
||||
InternalOptions,
|
||||
RequestInternal,
|
||||
ResponseInternal,
|
||||
} from "../.."
|
||||
} from "../../index.js"
|
||||
|
||||
/** Handle requests to /api/auth/signin */
|
||||
export async function signin(params: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { InternalOptions, ResponseInternal } from "../.."
|
||||
import type { Adapter } from "../../adapters"
|
||||
import type { SessionStore } from "../cookie"
|
||||
import type { InternalOptions, ResponseInternal } from "../../index.js"
|
||||
import type { Adapter } from "../../adapters.js"
|
||||
import type { SessionStore } from "../cookie.js"
|
||||
|
||||
/** Handle requests to /api/auth/signout */
|
||||
export async function signout(params: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CookieSerializeOptions } from "cookie"
|
||||
import type { Adapter, AdapterUser } from "../adapters"
|
||||
import type { Adapter, AdapterUser } from "../adapters.js"
|
||||
import type {
|
||||
CredentialInput,
|
||||
CredentialsConfig,
|
||||
@@ -7,16 +7,15 @@ import type {
|
||||
OAuthConfigInternal,
|
||||
Provider,
|
||||
ProviderType,
|
||||
} from "../providers"
|
||||
} from "../providers/index.js"
|
||||
import type {
|
||||
OAuth2TokenEndpointResponse,
|
||||
OpenIDTokenEndpointResponse,
|
||||
} from "oauth4webapi"
|
||||
import type { JWT, JWTOptions } from "../jwt"
|
||||
import type { Cookie } from "./cookie"
|
||||
import type { LoggerInstance } from "./utils/logger"
|
||||
import type { JWT, JWTOptions } from "../jwt/types.js"
|
||||
import type { Cookie } from "./cookie.js"
|
||||
import type { LoggerInstance } from "./utils/logger.js"
|
||||
|
||||
/** @internal */
|
||||
export type Awaitable<T> = T | PromiseLike<T>
|
||||
|
||||
export type { LoggerInstance }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UnknownError } from "../errors"
|
||||
import { UnknownError } from "../errors.js"
|
||||
|
||||
/** Makes sure that error is always serializable */
|
||||
function formatError(o: unknown): unknown {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { parse as parseCookie, serialize } from "cookie"
|
||||
import type { RequestInternal, ResponseInternal } from ".."
|
||||
import { UnknownAction } from "./errors"
|
||||
import type { AuthAction } from "./types"
|
||||
import type { RequestInternal, ResponseInternal } from "../index.js"
|
||||
import { UnknownAction } from "./errors.js"
|
||||
import type { AuthAction } from "./types.js"
|
||||
|
||||
async function getBody(req: Request): Promise<Record<string, any> | undefined> {
|
||||
if (!("body" in req) || !req.body || req.method !== "POST") return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface UserData {
|
||||
id: number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OAuthConfig, OAuthUserConfig } from "."
|
||||
import { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
/**
|
||||
* See more at:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
interface AtlassianProfile extends Record<string, any> {
|
||||
account_id: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface Auth0Profile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface AuthentikProfile extends Record<string, any> {
|
||||
iss: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface AzureB2CProfile extends Record<string, any> {
|
||||
exp: number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface AzureADProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface BattleNetProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface BoxyHQSAMLProfile extends Record<string, any> {
|
||||
id: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface CognitoProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CommonProviderOptions } from "."
|
||||
import type { Awaitable, RequestInternal, User } from ".."
|
||||
import type { CommonProviderOptions } from "./index.js"
|
||||
import type { Awaitable, RequestInternal, User } from "../index.js"
|
||||
|
||||
export interface CredentialInput {
|
||||
label?: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface DiscordProfile extends Record<string, any> {
|
||||
accent_color: number
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createTransport } from "nodemailer"
|
||||
|
||||
import type { CommonProviderOptions } from "."
|
||||
import type { CommonProviderOptions } from "./index.js"
|
||||
import type { Options as SMTPTransportOptions } from "nodemailer/lib/smtp-transport"
|
||||
import type { Awaitable, Theme } from ".."
|
||||
import type { Awaitable, Theme } from "../index.js"
|
||||
|
||||
export interface SendVerificationRequestParams {
|
||||
identifier: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface EVEOnlineProfile extends Record<string, any> {
|
||||
CharacterID: number
|
||||
@@ -17,7 +17,8 @@ export default function EVEOnline<P extends EVEOnlineProfile>(
|
||||
id: "eveonline",
|
||||
name: "EVE Online",
|
||||
type: "oauth",
|
||||
authorization: "https://login.eveonline.com/v2/oauth/authorize?scope=publicData",
|
||||
authorization:
|
||||
"https://login.eveonline.com/v2/oauth/authorize?scope=publicData",
|
||||
token: "https://login.eveonline.com/v2/oauth/token",
|
||||
userinfo: "https://login.eveonline.com/oauth/verify",
|
||||
profile(profile) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
interface FacebookPictureData {
|
||||
url: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
/** @see https://docs.github.com/en/rest/users/users#get-the-authenticated-user */
|
||||
export interface GithubProfile extends Record<string, any> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface GitLabProfile extends Record<string, any> {
|
||||
id: number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface GoogleProfile extends Record<string, any> {
|
||||
aud: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
interface HubSpotProfile extends Record<string, any> {
|
||||
// https://legacydocs.hubspot.com/docs/methods/oauth2/get-access-token-information
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { OAuthConfig, OAuthProvider, OAuthProviderType } from "./oauth"
|
||||
import type { EmailConfig, EmailProvider, EmailProviderType } from "./email"
|
||||
import type { OAuthConfig, OAuthProvider, OAuthProviderType } from "./oauth.js"
|
||||
import type { EmailConfig, EmailProvider, EmailProviderType } from "./email.js"
|
||||
import type {
|
||||
CredentialsConfig,
|
||||
CredentialsProvider,
|
||||
CredentialsProviderType,
|
||||
} from "./credentials"
|
||||
} from "./credentials.js"
|
||||
|
||||
export * from "./credentials"
|
||||
export * from "./email"
|
||||
export * from "./oauth"
|
||||
export * from "./credentials.js"
|
||||
export * from "./email.js"
|
||||
export * from "./oauth.js"
|
||||
|
||||
export type ProviderType = "oidc" | "oauth" | "email" | "credentials"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export type DateTime = string
|
||||
export type Gender = "female" | "male"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface KeycloakProfile extends Record<string, any> {
|
||||
exp: number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface LineProfile extends Record<string, any> {
|
||||
iss: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
interface Identifier {
|
||||
identifier: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
/** https://developers.naver.com/docs/login/profile/profile.md */
|
||||
export interface NaverProfile extends Record<string, any> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CommonProviderOptions } from "../providers"
|
||||
import type { Profile, TokenSet, User, Awaitable } from ".."
|
||||
import type { CommonProviderOptions } from "../providers/index.js"
|
||||
import type { Profile, TokenSet, User, Awaitable } from "../index.js"
|
||||
import type { Client } from "oauth4webapi"
|
||||
|
||||
// TODO:
|
||||
@@ -9,7 +9,7 @@ type IssuerMetadata = any
|
||||
type OAuthCallbackChecks = any
|
||||
type OpenIDCallbackChecks = any
|
||||
|
||||
export type { OAuthProviderType } from "./oauth-types"
|
||||
export type { OAuthProviderType } from "./oauth-types.js"
|
||||
|
||||
type ChecksType = "pkce" | "state" | "none" | "nonce"
|
||||
|
||||
@@ -96,6 +96,17 @@ export interface OAuthProviderButtonStyles {
|
||||
}
|
||||
|
||||
export interface OAuth2Config<P> extends CommonProviderOptions, PartialIssuer {
|
||||
/**
|
||||
* Identifies the provider when you want to sign in to
|
||||
* a specific provider.
|
||||
* @example
|
||||
* ```js
|
||||
* signIn('github') // "github" is the provider ID
|
||||
* ```
|
||||
*/
|
||||
id: string
|
||||
/** The name of the provider. shown on the default sign in page. */
|
||||
name: string
|
||||
/**
|
||||
* OpenID Connect (OIDC) compliant providers can configure
|
||||
* this instead of `authorize`/`token`/`userinfo` options
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface OktaProfile extends Record<string, any> {
|
||||
iss: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface OsuUserCompact {
|
||||
avatar_url: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface PatreonProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OAuthConfig, OAuthUserConfig } from "."
|
||||
import { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface PinterestProfile extends Record<string, any> {
|
||||
account_type: "BUSINESS" | "PINNER"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface PipedriveProfile extends Record<string, any> {
|
||||
success: boolean
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface SalesforceProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface SlackProfile extends Record<string, any> {
|
||||
ok: boolean
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface SpotifyImage {
|
||||
url: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface StravaProfile extends Record<string, any> {
|
||||
id: string // this is really a number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
/**
|
||||
* @see https://developer.todoist.com/sync/v9/#user
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface TraktUser extends Record<string, any> {
|
||||
username: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface TwitchProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: move OAuth 1.0 support or remove it?
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface TwitterLegacyProfile {
|
||||
id: number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface UnitedEffectsProfile extends Record<string, any> {
|
||||
sub: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface VkProfile {
|
||||
// https://dev.vk.com/reference/objects/user
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export type WikimediaGroup =
|
||||
| "*"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface WorkOSProfile extends Record<string, any> {
|
||||
object: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OIDCConfig, OAuthUserConfig } from "."
|
||||
import type { OIDCConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface ZitadelProfile extends Record<string, any> {
|
||||
amr: string // Authentication Method References as defined in RFC8176
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||
|
||||
export interface ZoomProfile extends Record<string, any> {
|
||||
id: string
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
"dependencies": {
|
||||
"@auth/core": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-kit": "^1.0.0"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
@@ -64,4 +68,4 @@
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
import { dev } from "$app/environment"
|
||||
import { AUTH_SECRET, AUTH_TRUST_HOST, VERCEL } from "$env/static/private"
|
||||
import { env } from "$env/dynamic/private"
|
||||
import { AUTH_SECRET } from "$env/static/private"
|
||||
import {
|
||||
AuthHandler,
|
||||
type AuthAction,
|
||||
@@ -81,7 +82,7 @@ function SvelteKitAuthHandler(
|
||||
export default function SvelteKitAuth(options: SvelteKitAuthOptions): Handle {
|
||||
const { prefix = "/auth", ...authOptions } = options
|
||||
authOptions.secret ??= AUTH_SECRET
|
||||
authOptions.trustHost ??= !!(AUTH_TRUST_HOST ?? VERCEL ?? dev)
|
||||
authOptions.trustHost ??= !!(env.AUTH_TRUST_HOST ?? env.VERCEL ?? dev)
|
||||
|
||||
return SvelteKitAuthHandler(prefix, authOptions)
|
||||
}
|
||||
@@ -98,8 +99,11 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
declare module "$env/static/private" {
|
||||
export const AUTH_SECRET: string
|
||||
declare module "$env/dynamic/private" {
|
||||
export const AUTH_TRUST_HOST: string
|
||||
export const VERCEL: string
|
||||
}
|
||||
|
||||
declare module "$env/static/private" {
|
||||
export const AUTH_SECRET: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user