Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/auth0-auth-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const authClient = new AuthClient({
});
```

The `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, and `AUTH0_CLIENT_SECRET` can be obtained from the [Auth0 Dashboard](https://manage.auth0.com) once you've created an application.
The `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, and `AUTH0_CLIENT_SECRET` can be obtained from the [Auth0 Dashboard](https://manage.auth0.com) once you've created an application.

### 3. Build the Authorization URL

Expand Down
307 changes: 234 additions & 73 deletions packages/auth0-server-js/EXAMPLES.md

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion packages/auth0-server-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const auth0 = new ServerClient<StoreOptions>({
```

The `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, and `AUTH0_CLIENT_SECRET` can be obtained from the [Auth0 Dashboard](https://manage.auth0.com) once you've created an application. **This application must be a `Regular Web Application`**.
The `AUTH0_REDIRECT_URI` is needed to tell Auth0 what URL to redirect back to after successfull authentication, e.g. `http://localhost:3000/auth/callback`. (note, your application needs to handle this endpoint and call the SDK's `completeInteractiveLogin(url: string)` to finish the authentication process. See below for more information)
The `AUTH0_REDIRECT_URI` is needed to tell Auth0 what URL to redirect back to after successful authentication, e.g. `http://localhost:3000/auth/callback`. Your application needs to handle this endpoint and call the SDK's `completeInteractiveLogin(url: string)` to finish the authentication process. See below for more information.


### 3. Configuring the Store

Expand Down Expand Up @@ -200,6 +201,10 @@ const auth0 = new ServerClient<StoreOptions>({
});
```

The `redirect_uri` must be an absolute URL.

If you need to compute an absolute redirect URI per request (for example, in multi-domain deployments), pass `authorizationParams.redirect_uri` to `startInteractiveLogin` to override the configured default.

> [!IMPORTANT]
> You will need to register the `AUTH0_REDIRECT_URI` in your Auth0 Application as an **Allowed Callback URLs** via the [Auth0 Dashboard](https://manage.auth0.com):

Expand Down
12 changes: 12 additions & 0 deletions packages/auth0-server-js/src/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, expect, test } from 'vitest';
import { StartLinkUserError } from './errors.js';

describe('StartLinkUserError', () => {
test('sets name and code', () => {
const error = new StartLinkUserError('link failed');

expect(error.message).toBe('link failed');
expect(error.name).toBe('StartLinkUserError');
expect(error.code).toBe('start_link_user_error');
});
});
14 changes: 13 additions & 1 deletion packages/auth0-server-js/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ export class InvalidConfigurationError extends Error {
super(message);
this.name = 'InvalidConfigurationError';
}
}
}

/**
* Error thrown when the issuer validation fails.
*/
export class IssuerValidationError extends Error {
public code: string = 'issuer_validation_error';

constructor(message: string) {
super(message);
this.name = 'IssuerValidationError';
}
}
Loading
Loading