# context object

The context of the current authentication process is saved in the'context object, including authentication means, identity provider, and request IP, address, etc. '

# Attributes

Attribute Data 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
request object The detailed information of the current request, including:
ip: client IP
geo: client geographic location resolved by IP
body: request body,
query: query string object, you can get the corresponding query parameter through request.query.xxx

# protocol

Authentication agreement.

Possible values Description
password Authentication method based on account password
sms Authentication method based on SMS verification code
social The default social login authentication, this value when using Authing integrated social login means login.
ldap Use LDAP for authentication. For how to access LDAP, please refer to Configure LDAP Service.
saml Use SAML for authentication. For how to access SAML, please see Access SAML.
oidc Use OIDC protocol authentication. For how to access OIDC, please see Using OIDC Authorization.

# connection

Identity provider.

Possible values Description
ldap Use lDAP protocol to log in. An Authing LDAP service corresponds to an Authing user directory or a third-party user directory, please see Configure LDAP service and use Authenticating LDAP user directory .
saml Log in using the SAML protocol. For how to access SAML, please see Access SAML.
oidc Use OIDC protocol for authentication. For how to access OIDC, please see Using OIDC Authorization.
github Log in with GitHub. See details Access GitHub login.

wechat

WeChat PC scan code login. See details Access the Wechat PC and scan the code to log in.
wechat:miniprogram Log in using the WeChat applet. See details Access the WeChat Mini Program to log in.
wechatwork Log in using corporate WeChat.
qq Log in using the QQ web version. See details Access QQ login.
weibo Log in using Weibo web version. See details Access Weibo to log in.
dingtalk Log in using DingTalk web version. See details Access DingTalk to log in.
alipay Use Alipay APP to log in. See details Access mobile APP Alipay login .

# data object

# Before and after registration

Before and after registration, the requested fields of the data object in the Pipeline are as follows: For details, please see Authing GraphQL Debugger (opens new window) User Authentication-Registration interface.

Email, phone, unionid and other fields may not exist at the same time, please check whether they exist before using! Such as

const email = context.request.body.email;
if (email) {
  // Means to register with email
  // The logic of mailbox registration whitelist can be carried out

  if (!email.endsWith("example.com")) {
    return callback(new Error("Access Denied!"));
  }
}
Field name Type Must exist Description
username string No Username, which is not empty when registering with username.
email string No Email, it is not empty when registering with the user name.
phone string No Mobile phone number, it is not empty when registering with mobile phone number.
forceLogin boolean No Whether to automatically log in when registering, the default is false
profile object yes data user information filled in user registration

# Before and after certification

The requested fields of the data object in the pipeline before and after authentication are as follows:

These fields may not all exist, please judge whether they exist before using!

Field name Type Must exist Description
username string No Username, which is not empty when logging in with the username.
email string No Email, it is not empty when logging in with email.
phone string No Mobile phone number, it is not empty when logging in with the phone number.

# userPool object

Field name Type Description
id string User pool ID
name string User pool name

# geo attributes

Sample data:

{
  "province": "Beijing",
  "city": "Beijing",
  "adcode": "110000",
  "rectangle": "116.0119343,39.66127144;116.7829835,40.2164962"
}