Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

    • User Authentication Module

      • User authentication module
      • Standard agreement certification module
      • Scan code login module
      • Multi-factor authentication module
      • Social login module
      • Corporate identity source login module
      • Main authentication module
    • Management Module

  • Java / Kotlin

  • Python

  • C#

  • PHP

  • Go

  • Ruby
  • Android

  • iOS

  • Flutter

  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code
  1. Development Integration
  2. /
  3. JavaScript/Node.js
  4. /
  5. User Authentication Module
  6. /
  7. Main authentication module

¶ Main authentication module

Update Time: 2025-05-14 08:32:28
Edit

This module is used to conduct body authentication, such as personal authentication or corporate certification.

Sample code:

import { AuthenticationClient } from 'authing-js-sdk'
const authenticationClient = new AuthenticationClient({
  appId: 'AUTHING_APP_ID',
  appHost: 'https://{YOUR_DOMAIN}.authing.cn',
})

authenticationClient.principal.detail
authenticationClient.principal.authenticate

¶ Obtain certification details

PrincipalAuthentication().detail()

Get the main authentication details

¶ parameter

without

¶ Example

const authenticationClient = new AuthenticationClient({
  appId: 'AUTHING_APP_ID',
  appHost: 'https://{YOUR_DOMAIN}.authing.cn',
})
const authenticators = await authenticationClient.principal.detail()

¶ return value

  • Promise<PrincipalDetail | null>, return when not authenticated null

¶ Sample data

{
  "id": "60b4d72f56b49fb97281001b",
  "createdAt": "2021-05-31T12:31:43.416Z",
  "updatedAt": "2021-05-31T12:31:43.416Z",
  "userPoolId": "607fe30c14d1650eb1d888ca",
  "userId": "60a336dc179abb512dd64ae7",
  "principalType": "P", // "P" represents personal authentication, "E" individual authentication
  "principalName": "xxx",
  "principalCode": "xxxxxxxxxxxxxxx",
  "authenticationTime": "2021-05-31T12:31:43.414Z"
}

¶ Subject authentication

PrincipalAuthentication().authenticate(principalInfo)

Subject authentication

¶ parameter

The parameters that are incorporated when performing personal authentication and corporate certification, as follows.

¶ Personal authentication
  • principalInfo: <object>
    • principalInfo.type: <string> Personal certification should be passed to the fixed string "P"
    • principalInfo.name: <string> Personal real name
    • principalInfo.idCard: <string> Personal ID number
    • principalInfo.bankCard: <string> Personal bank card number
¶ Enterprise Certification
  • principalInfo: <object>
    • principalInfo.type: <string> Companies should pass authentication fixed string "E"
    • principalInfo.enterpriseName: <string> Company Name
    • principalInfo.enterpriseCode: <string> Enterprise unified social credit code
    • principalInfo.legalPersonName: <string> Corporate legal name

¶ Example

const authenticationClient = new AuthenticationClient({
  appId: 'AUTHING_APP_ID',
  appHost: 'https://{YOUR_DOMAIN}.authing.cn',
})
await authenticationClient.principal.authenticate({
  type: 'P',
  name: 'xxx',
  idCard: 'xxxxxxxxxxxxxxxx',
  bankCard: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
})

¶ return value

  • Promise<boolean>, the authentication is successful return true

¶ Sample data

true
Prev: Corporate identity source login module Next: Management Module
  • Obtain certification details
  • Subject authentication

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.