docs: fixes and improvements to auth flow documentation (#8909)
This commit is contained in:
@@ -3,16 +3,18 @@ sidebar_label: "Authentication Flows"
|
||||
---
|
||||
|
||||
export const metadata = {
|
||||
title: `Authentication Flows with the Auth Provider`,
|
||||
title: `Authentication Flows with the Auth Main Service`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you'll learn how to use the Auth Provider's main service's methods to implement an authentication flow.
|
||||
In this document, you'll learn how to use the Auth Module's main service's methods to implement an authentication flow.
|
||||
|
||||
## How to Register an Auth Identity
|
||||
## Authentication Methods
|
||||
|
||||
The `register` method of the Auth Module's main service creates an auth identity that can be authenticated later.
|
||||
### Register
|
||||
|
||||
The [register method of the Auth Module's main service](/references/auth/register) creates an auth identity that can be authenticated later.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -28,9 +30,7 @@ const data = await authModuleService.register(
|
||||
|
||||
This method calls the `register` method of the provider specified in the first parameter and returns its data.
|
||||
|
||||
---
|
||||
|
||||
## How to Authenticate a User
|
||||
### Authenticate
|
||||
|
||||
To authenticate a user, you use the [authenticate method of the Auth Module's main service](/references/auth/authenticate). For example:
|
||||
|
||||
@@ -46,7 +46,11 @@ const data = await authModuleService.authenticate(
|
||||
|
||||
This method calls the `authenticate` method of the provider specified in the first parameter and returns its data.
|
||||
|
||||
### Basic Authentication Flow
|
||||
---
|
||||
|
||||
## Auth Flow 1: Basic Authentication
|
||||
|
||||
The basic authentication flow requires first using the `register` method, then the `authenticate` method.
|
||||
|
||||
If the `authenticate` method returns the following object:
|
||||
|
||||
@@ -69,7 +73,11 @@ Check out the [AuthIdentity](/references/auth/models/AuthIdentity) reference for
|
||||
|
||||

|
||||
|
||||
### Authentication with Third-Party Service Flow
|
||||
---
|
||||
|
||||
## Auth Flow 2: Third-Party Service Authentication
|
||||
|
||||
The third-party service authentication method requires using the `authenticate` method first.
|
||||
|
||||
If the `authenticate` method returns the following object:
|
||||
|
||||
@@ -84,7 +92,7 @@ It means the authentication process requires the user to perform an action with
|
||||
|
||||

|
||||
|
||||
#### validateCallback
|
||||
### validateCallback
|
||||
|
||||
Providers handling this authentication flow must implement the `validateCallback` method. It implements the logic to validate the authentication with the third-party service.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user