¶ Context Object
Update Time: 2025-11-10 02:59:49
The context object saves the context of the current authentication process, including authentication means, identity provider, and request IP, address, etc.
¶ Attributes
| Attribute name | Type | Description |
|---|---|---|
| protocol | string | Authentication protocol. See below for specific instructions. |
| connection | string | Identity provider. See below for specific instructions. |
| userPoolId | string | User pool ID |
| userPoolName | string | User pool name |
| userPoolMetadata | object | User pool configuration |
| appId | string | ID of the current user |
| appName | string | The name of the current application |
| appMetadata | object | Configuration information of the current application |
| request | object | Details of the current request, including:ip: Client IPgeo: The geographical location of the client resolved by IPbody: request bodyquery: query string object,you can get the corresponding query parameters through request.query.xxx |
¶ protocol
Authentication protocol.
| Possible value | Description |
|---|---|
| password | Authentication method based on account password |
| sms | Authentication method based on SMS verification code |
| social | The social login authentication default value when logging in with the Authing integrated social login method. |
| ldap | Use LDAP for authentication. For how to access LDAP, please refer to Configuring LDAP Service。 |
| saml | Use SAML for authentication. For how to access SAML, please refer to Access SAML。 |
| oidc | Use OIDC protocol for authentication. For how to access OIDC, please refer to Using OIDC Authorization。 |
¶ connection
Identity provider.
| Possible value | Description |
|---|---|
| ldap | Use lDAP protocol to log in. An Authing LDAP service corresponds to an Authing user directory or a third-party user directory. For details, refer to Configuring LDAP Service and Using Authing LDAP User Directory. |
| saml | Log in using the SAML protocol. For how to access SAML, refer to Accessing SAML. |
| oidc | Use OIDC protocol authentication. For information on how to access OIDC, please refer to Using OIDC Authorization. |
| github | Log in with GitHub. For details, refer to Access GitHub Login. |
¶ Before and after registration
Before and after registration, the requested fields of the data object in the Pipeline are as follows: For details, refer to Authing GraphQL Debugger (opens new window) User Authentication - RegistrationInterface.
email, phone, unionid and other fields may not exist at the same time, please check whether they exist before using them. For example:
const email = context.request.body.email;
if (email) {
// 表示是用邮箱注册
// 可以进行邮箱注册白名单的逻辑
if (!email.endsWith("example.com")) {
return callback(new Error("Access Denied!"));
}
}
| Field Name | Type | Exist | Description |
|---|---|---|---|
| username | string | No | User name. It is not empty when registering with the user name |
| string | No | Email address. It is not empty when registering with the user name | |
| phone | string | No | Mobile phone number. It is not empty when using the mobile phone number to register |
| forceLogin | boolean | No | Whether to automatically perform the login process when registering, the default is false |
| profile | object | Yes | User information filled in for user registration |
¶ Before and after authentication
The request fields of the data object in the pipeline before and after authentication are as follows:
These fields may not all exist, please check whether they exist before using them.
| Field Name | Type | Exist | Description |
|---|---|---|---|
| username | string | No | User name, which is not empty when logging in using user name. |
| string | No | Email, which is not empty when logging in using email. | |
| phone | string | No | Mobile phone number, which is not empty when logging in using mobile phone number. |
¶ userPool object
| Field Name | Type | Description |
|---|---|---|
| id | string | User pool ID |
| name | string | User pool name |
¶ geo Attribute
Sample data:
{
"province": "北京市",
"city": "北京市",
"adcode": "110000",
"rectangle": "116.0119343,39.66127144;116.7829835,40.2164962"
}