Skip to content

Commit

Permalink
chore(core): update links in typedocs to new docs URLs (#10560)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Apr 12, 2024
1 parent dbebf36 commit 6aa4c44
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 69 deletions.
62 changes: 31 additions & 31 deletions packages/core/src/adapters.ts
Expand Up @@ -6,7 +6,7 @@
* This module contains utility functions and types to create an Auth.js compatible adapter.
*
* Auth.js supports 2 session strategies to persist the login state of a user.
* The default is to use a cookie + {@link https://authjs.dev/concepts/session-strategies#jwt JWT}
* The default is to use a cookie + {@link https://authjs.dev/concepts/session-strategies#jwt-session JWT}
* based session store (`strategy: "jwt"`),
* but you can also use a database adapter to store the session in a database.
*
Expand Down Expand Up @@ -143,21 +143,20 @@
*
* ### Token rotation
*
* Auth.js _currently_ does not support {@link https://authjs.dev/concepts/oauth#token-rotation `access_token` rotation} out of the box.
* Auth.js _currently_ does not support {@link https://authjs.dev/concepts/oauth `access_token` rotation} out of the box.
* The necessary information (`refresh_token`, expiry, etc.) is being stored in the database, but the logic to rotate the token is not implemented
* in the core library.
* [This guide](https://authjs.dev/guides/basics/refresh-token-rotation#database-strategy) should provide the necessary steps to do this in user land.
* [This guide](https://authjs.dev/guides/refresh-token-rotation#database-strategy) should provide the necessary steps to do this in user land.
*
* ### Federated logout
*
* Auth.js _currently_ does not support {@link https://authjs.dev/concepts/oauth#federated-logout federated logout} out of the box.
* Auth.js _currently_ does not support federated logout out of the box.
* This means that even if an active session is deleted from the database, the user will still be signed in to the identity provider,
* they will only be signed out of the application.
* Eg. if you use Google as an identity provider, and you delete the session from the database,
* the user will still be signed in to Google, but they will be signed out of your application.
*
* If your users might be using the application from a publicly shared computer (eg: library), you might want to implement federated logout.
* {@link https://authjs.dev/guides/providers/federated-logout This guide} should provide the necessary steps.
*
* @module adapters
*/
Expand All @@ -180,7 +179,7 @@ export interface AdapterUser extends User {
/** The user's email address. */
email: string
/**
* Whether the user has verified their email address via an [Email provider](https://authjs.dev/reference/core/providers/email).
* Whether the user has verified their email address via an [Email provider](https://authjs.dev/getting-started/authentication/email).
* It is `null` if the user has not signed in with the Email provider yet, or the date of the first successful signin.
*/
emailVerified: Date | null
Expand All @@ -191,7 +190,7 @@ export interface AdapterUser extends User {
*
* There are two types of accounts:
* - OAuth/OIDC accounts, which are created when a user signs in with an OAuth provider.
* - Email accounts, which are created when a user signs in with an [Email provider](https://authjs.dev/reference/core/providers/email).
* - Email accounts, which are created when a user signs in with an [Email provider](https://authjs.dev/getting-started/authentication/email).
*
* One user can have multiple accounts.
*/
Expand Down Expand Up @@ -228,7 +227,7 @@ export interface AdapterSession {

/**
* A verification token is a temporary token that is used to sign in a user via their email address.
* It is created when a user signs in with an [Email provider](https://authjs.dev/reference/core/providers/email).
* It is created when a user signs in with an [Email provider](https://authjs.dev/getting-started/authentication/email).
* When the user clicks the link in the email, the token and email is sent back to the server
* where it is hashed and compared to the value in the database.
* If the tokens and emails match, and the token hasn't expired yet, the user is signed in.
Expand All @@ -240,7 +239,7 @@ export interface VerificationToken {
/** The absolute date when the token expires. */
expires: Date
/**
* A [hashed](https://authjs.dev/concepts/hashing) token, using the `AuthConfig.secret` value.
* A [hashed](https://en.wikipedia.org/wiki/Hash_function) token, using the `AuthConfig.secret` value.
*/
token: string
}
Expand Down Expand Up @@ -276,41 +275,41 @@ export interface Adapter {
/**
* Creates a user in the database and returns it.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
createUser?(user: AdapterUser): Awaitable<AdapterUser>
/**
* Returns a user from the database via the user id.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
getUser?(id: string): Awaitable<AdapterUser | null>
/**
* Returns a user from the database via the user's email address.
*
* See also [Verification tokens](https://authjs.dev/guides/adapters/creating-a-database-adapter#verification-tokens)
* See also [Verification tokens](https://authjs.dev/guides/creating-a-database-adapter#verification-tokens)
*/
getUserByEmail?(email: string): Awaitable<AdapterUser | null>
/**
* Using the provider id and the id of the user for a specific account, get the user.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
getUserByAccount?(
providerAccountId: Pick<AdapterAccount, "provider" | "providerAccountId">
): Awaitable<AdapterUser | null>
/**
* Updates a user in the database and returns it.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
updateUser?(
user: Partial<AdapterUser> & Pick<AdapterUser, "id">
): Awaitable<AdapterUser>
/**
* @todo This method is currently not invoked yet.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
deleteUser?(
userId: string
Expand All @@ -319,7 +318,7 @@ export interface Adapter {
* This method is invoked internally (but optionally can be used for manual linking).
* It creates an [Account](https://authjs.dev/reference/core/adapters#models) in the database.
*
* See also [User management](https://authjs.dev/guides/adapters/creating-a-database-adapter#user-management)
* See also [User management](https://authjs.dev/guides/creating-a-database-adapter#user-management)
*/
linkAccount?(
account: AdapterAccount
Expand All @@ -331,7 +330,7 @@ export interface Adapter {
/**
* Creates a session for the user and returns it.
*
* See also [Database Session management](https://authjs.dev/guides/adapters/creating-a-database-adapter#database-session-management)
* See also [Database Session management](https://authjs.dev/guides/creating-a-database-adapter#database-session-management)
*/
createSession?(session: {
sessionToken: string
Expand All @@ -345,15 +344,15 @@ export interface Adapter {
* If the database supports joins, it's recommended to reduce the number of database queries.
* :::
*
* See also [Database Session management](https://authjs.dev/guides/adapters/creating-a-database-adapter#database-session-management)
* See also [Database Session management](https://authjs.dev/guides/creating-a-database-adapter#database-session-management)
*/
getSessionAndUser?(
sessionToken: string
): Awaitable<{ session: AdapterSession; user: AdapterUser } | null>
/**
* Updates a session in the database and returns it.
*
* See also [Database Session management](https://authjs.dev/guides/adapters/creating-a-database-adapter#database-session-management)
* See also [Database Session management](https://authjs.dev/guides/creating-a-database-adapter#database-session-management)
*/
updateSession?(
session: Partial<AdapterSession> & Pick<AdapterSession, "sessionToken">
Expand All @@ -362,15 +361,15 @@ export interface Adapter {
* Deletes a session from the database. It is preferred that this method also
* returns the session that is being deleted for logging purposes.
*
* See also [Database Session management](https://authjs.dev/guides/adapters/creating-a-database-adapter#database-session-management)
* See also [Database Session management](https://authjs.dev/guides/creating-a-database-adapter#database-session-management)
*/
deleteSession?(
sessionToken: string
): Promise<void> | Awaitable<AdapterSession | null | undefined>
/**
* Creates a verification token and returns it.
*
* See also [Verification tokens](https://authjs.dev/guides/adapters/creating-a-database-adapter#verification-tokens)
* See also [Verification tokens](https://authjs.dev/guides/creating-a-database-adapter#verification-tokens)
*/
createVerificationToken?(
verificationToken: VerificationToken
Expand All @@ -379,31 +378,32 @@ export interface Adapter {
* Return verification token from the database and deletes it
* so it can only be used once.
*
* See also [Verification tokens](https://authjs.dev/guides/adapters/creating-a-database-adapter#verification-tokens)
* See also [Verification tokens](https://authjs.dev/guides/creating-a-database-adapter#verification-tokens)
*/
useVerificationToken?(params: {
identifier: string
token: string
}): Awaitable<VerificationToken | null>
/**
* Get account by provider account id and provider.
*
*
* If an account is not found, the adapter must return `null`.
*/
getAccount?(
providerAccountId: AdapterAccount["providerAccountId"], provider: AdapterAccount["provider"]
providerAccountId: AdapterAccount["providerAccountId"],
provider: AdapterAccount["provider"]
): Awaitable<AdapterAccount | null>
/**
* Returns an authenticator from its credentialID.
*
*
* If an authenticator is not found, the adapter must return `null`.
*/
getAuthenticator?(
credentialID: AdapterAuthenticator['credentialID']
credentialID: AdapterAuthenticator["credentialID"]
): Awaitable<AdapterAuthenticator | null>
/**
* Create a new authenticator.
*
*
* If the creation fails, the adapter must throw an error.
*/
createAuthenticator?(
Expand All @@ -416,16 +416,16 @@ export interface Adapter {
* If the retrieval fails for some other reason, the adapter must throw an error.
*/
listAuthenticatorsByUserId?(
userId: AdapterAuthenticator['userId']
userId: AdapterAuthenticator["userId"]
): Awaitable<AdapterAuthenticator[]>
/**
* Updates an authenticator's counter.
*
*
* If the update fails, the adapter must throw an error.
*/
updateAuthenticatorCounter?(
credentialID: AdapterAuthenticator['credentialID'],
newCounter: AdapterAuthenticator['counter']
credentialID: AdapterAuthenticator["credentialID"],
newCounter: AdapterAuthenticator["counter"]
): Awaitable<AdapterAuthenticator>
}

Expand Down
26 changes: 13 additions & 13 deletions packages/core/src/errors.ts
Expand Up @@ -118,23 +118,23 @@ export class AccessDenied extends AuthError {
* ```
* :::
*
* For an [OAuth provider](https://authjs.dev/reference/core/providers/oauth), possible causes are:
* For an [OAuth provider](https://authjs.dev/getting-started/authentication/oauth), possible causes are:
* - The user denied access to the application
* - There was an error parsing the OAuth Profile:
* Check out the provider's `profile` or `userinfo.request` method to make sure
* it correctly fetches the user's profile.
* - The `signIn` or `jwt` callback methods threw an uncaught error:
* Check the callback method implementations.
*
* For an [Email provider](https://authjs.dev/reference/core/providers/email), possible causes are:
* For an [Email provider](https://authjs.dev/getting-started/authentication/email), possible causes are:
* - The provided email/token combination was invalid/missing:
* Check if the provider's `sendVerificationRequest` method correctly sends the email.
* - The provided email/token combination has expired:
* Ask the user to log in again.
* - There was an error with the database:
* Check the database logs.
*
* For a [Credentials provider](https://authjs.dev/reference/core/providers/credentials), possible causes are:
* For a [Credentials provider](https://authjs.dev/getting-started/authentication/credentials), possible causes are:
* - The `authorize` method threw an uncaught error:
* Check the provider's `authorize` method.
* - The `signIn` or `jwt` callback methods threw an uncaught error:
Expand All @@ -155,7 +155,7 @@ export class CallbackRouteError extends AuthError {
*
* To fix this, make sure that the `error` page does not require authentication.
*
* Learn more at [Guide: Error pages](https://authjs.dev/guides/basics/pages)
* Learn more at [Guide: Error pages](https://authjs.dev/guides/pages/error)
*/
export class ErrorPageLoop extends AuthError {
static type = "ErrorPageLoop"
Expand Down Expand Up @@ -213,7 +213,7 @@ export class CredentialsSignin extends SignInError {
* One of the configured OAuth or OIDC providers is missing the `authorization`, `token` or `userinfo`, or `issuer` configuration.
* To perform OAuth or OIDC sign in, at least one of these endpoints is required.
*
* Learn more at [`OAuth2Config`](https://authjs.dev/reference/core/providers#oauth2configprofile) or [Guide: OAuth Provider](https://authjs.dev/guides/providers/custom-provider)
* Learn more at [`OAuth2Config`](https://authjs.dev/reference/core/providers#oauth2configprofile) or [Guide: OAuth Provider](https://authjs.dev/guides/configuring-oauth-providers)
*/
export class InvalidEndpoints extends AuthError {
static type = "InvalidEndpoints"
Expand All @@ -238,7 +238,7 @@ export class InvalidCheck extends AuthError {
* When this error is logged, the session cookie is destroyed.
* :::
*
* Learn more at [`secret`](https://authjs.dev/reference/core#secret), [`jwt.encode`](https://authjs.dev/reference/core/jwt#encode) or [`jwt.decode`](https://authjs.dev/reference/core/jwt#decode) for more information.
* Learn more at [`secret`](https://authjs.dev/reference/core#secret), [`jwt.encode`](https://authjs.dev/reference/core/jwt#encode-1) or [`jwt.decode`](https://authjs.dev/reference/core/jwt#decode-2) for more information.
*/
export class JWTSessionError extends AuthError {
static type = "JWTSessionError"
Expand All @@ -249,7 +249,7 @@ export class JWTSessionError extends AuthError {
* or tried using a `strategy: "database"` session without a database adapter.
* In both cases, make sure you either remove the configuration or add the missing adapter.
*
* Learn more at [Database Adapters](https://authjs.dev/getting-started/adapters), [Email provider](https://authjs.dev/reference/core/providers/email) or [Concept: Database session strategy](https://authjs.dev/concepts/session-strategies#database)
* Learn more at [Database Adapters](https://authjs.dev/getting-started/database), [Email provider](https://authjs.dev/getting-started/authentication/email) or [Concept: Database session strategy](https://authjs.dev/concepts/session-strategies#database-session)
*/
export class MissingAdapter extends AuthError {
static type = "MissingAdapter"
Expand All @@ -260,7 +260,7 @@ export class MissingAdapter extends AuthError {
*
* Make sure you either remove the configuration or add the missing methods to the adapter.
*
* Learn more at [Database Adapters](https://authjs.dev/reference/core/adapters)
* Learn more at [Database Adapters](https://authjs.dev/getting-started/database)
*/
export class MissingAdapterMethods extends AuthError {
static type = "MissingAdapterMethods"
Expand All @@ -270,7 +270,7 @@ export class MissingAdapterMethods extends AuthError {
* Thrown when a Credentials provider is missing the `authorize` configuration.
* To perform credentials sign in, the `authorize` method is required.
*
* Learn more at [Credentials provider](https://authjs.dev/reference/core/providers/credentials)
* Learn more at [Credentials provider](https://authjs.dev/getting-started/authentication/credentials)
*/
export class MissingAuthorize extends AuthError {
static type = "MissingAuthorize"
Expand Down Expand Up @@ -322,7 +322,7 @@ export class OAuthCallbackError extends SignInError {
/**
* This error occurs during an OAuth sign in attempt when the provider's
* response could not be parsed. This could for example happen if the provider's API
* changed, or the [`OAuth2Config.profile`](https://authjs.dev/reference/core/providers/oauth#profile) method is not implemented correctly.
* changed, or the [`OAuth2Config.profile`](https://authjs.dev/reference/core/providers#oauth2configprofile) method is not implemented correctly.
*/
export class OAuthProfileParseError extends AuthError {
static type = "OAuthProfileParseError"
Expand All @@ -340,7 +340,7 @@ export class SessionTokenError extends AuthError {
}

/**
* Happens when login by [OAuth](https://authjs.dev/getting-started/providers/oauth-tutorial) could not be started.
* Happens when login by [OAuth](https://authjs.dev/getting-started/authentication/oauth) could not be started.
*
* Possible causes are:
* - The Authorization Server is not compliant with the [OAuth 2.0](https://www.ietf.org/rfc/rfc6749.html) or the [OIDC](https://openid.net/specs/openid-connect-core-1_0.html) specification.
Expand All @@ -359,7 +359,7 @@ export class OAuthSignInError extends SignInError {
}

/**
* Happens when the login by an [Email provider](https://authjs.dev/getting-started/providers/email-tutorial) could not be started.
* Happens when the login by an [Email provider](https://authjs.dev/getting-started/authentication/email) could not be started.
*
* Possible causes are:
* - The email sent from the client is invalid, could not be normalized by [`EmailConfig.normalizeIdentifier`](https://authjs.dev/reference/core/providers/email#normalizeidentifier)
Expand Down Expand Up @@ -398,7 +398,7 @@ export class UnknownAction extends AuthError {
/**
* Thrown when a Credentials provider is present but the JWT strategy (`strategy: "jwt"`) is not enabled.
*
* Learn more at [`strategy`](https://authjs.dev/reference/core#strategy) or [Credentials provider](https://authjs.dev/reference/core/providers/credentials)
* Learn more at [`strategy`](https://authjs.dev/reference/core#strategy) or [Credentials provider](https://authjs.dev/getting-started/authentication/credentials)
*/
export class UnsupportedStrategy extends AuthError {
static type = "UnsupportedStrategy"
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/index.ts
Expand Up @@ -8,7 +8,7 @@
*
* Based on the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Request}
* and {@link https://developer.mozilla.org/en-US/docs/Web/API/Response Response} Web standard APIs.
* Primarily used to implement [framework](https://authjs.dev/concepts/frameworks)-specific packages,
* Primarily used to implement [framework](https://authjs.dev/getting-started/integrations)-specific packages,
* but it can also be used directly.
*
* ## Installation
Expand All @@ -30,8 +30,8 @@
*
* ## Resources
*
* - [Getting started](https://authjs.dev/getting-started/introduction)
* - [Most common use case guides](https://authjs.dev/guides)
* - [Getting started](https://authjs.dev/getting-started)
* - [Guides](https://authjs.dev/guides)
*
* @module @auth/core
*/
Expand Down

0 comments on commit 6aa4c44

Please sign in to comment.