GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
Development Integration
  • API

  • SDK

    • Java

    • Node.js

    • Python

      • Installation and Usage
      • Authentication Module

        • Login

          • Login with Account Password
          • Login with Username Password
          • Login with Phone Password
          • Login with Email Password
          • Login with Email Passcode
          • Login with Phone Passcode
          • Login with LDAP Account
          • Login with AD Account
          • Login with User Credentials
          • Login with Mobile Social Login
          • Get Alipay AuthInfo
          • Generate QR Code for Login
          • Check QR Code Status
          • Exchange TokenSet with QR Code Ticket
          • Custom APP QR Code Login: Change QR Code Status on APP Side
        • Logout

        • Register

        • User Profile

        • Account Binding

        • MFA Factor Management

        • User Related Resources

        • Message Service

        • WeChat Related APIs

        • Others

        • OIDC Module
        • OAuth Module
        • SAML Module
        • CAS Module
        • Events
      • Management Module

  • Error Codes
  1. Development Integration
  2. /
  3. SDK
  4. /
  5. Python
  6. /
  7. Authentication Module

  8. /
  9. Login

  10. /
  11. Login with User Credentials

¶ Login using user credentials

Update time: 2025-07-23 07:34:21
Edit

This document is automatically generated based on https://github.com/authing/authing-docs-factory based on the https://api-explorer.genauth.ai V3 API, and is consistent with the API parameters and return results. If this document description is incorrect, please refer to the V3 API.

This endpoint is a login endpoint based on direct API calls, which is suitable for scenarios where you need to build your own login page. ** This endpoint does not currently support MFA, information completion, first password reset and other processes. If necessary, please use the OIDC standard protocol authentication endpoint. **

Note: Depending on the ** application type ** you selected when creating the application in GenAuth and the ** token exchange authentication method ** configured in the application, different forms of verification of the client's identity are required when calling this interface.

Click to expand details

You can find the Exchange token authentication method configuration item in Application - Self-built application - Application details - Application configuration - Other settings - Authorization configuration in the GenAuth console (opens new window):

Single-page web applications and client applications are hidden, and the default value is none, which is not allowed to be modified; backend applications and standard web applications can modify this configuration item.

¶ When the exchange token authentication method is none

No additional operations are required to call this interface.

¶ When the exchange token authentication method is client_secret_post

When calling this interface, the client_id and client_secret parameters must be passed in the body as conditions for verifying the client identity. Among them, client_id is the application ID, and client_secret is the application secret key.

¶ When exchanging token authentication mode is client_secret_basic

When calling this interface, the authorization request header must be carried in the HTTP request header as a condition for verifying the client's identity. The format of the authorization request header is as follows (where client_id is the application ID, and client_secret is the application secret key.):

Basic base64(<client_id>:<client_secret>)

Example result:

Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3

JS Code example:

"Basic " + Buffer.from(client_id + ":" + client_secret).toString("base64");

¶ Method name

AuthenticationClient.sign_in_by_credentials

¶ Request parameters

NameType
Is it required?
Default value
Description
Sample value
connectionstringYes-Authentication method:
- PASSWORD: Use password authentication.
- PASSCODE: Use one-time temporary verification code authentication.
- LDAP: Use LDAP user directory authentication.
- AD: Use Windows AD user directory authentication.
PASSWORD
passwordPayloadSignInByPasswordPayloadDtoNo-This parameter is required when the authentication method is PASSWORD.{"email":"test@example.com","password":"passw0rd"}
passCodePayloadSignInByPassCodePayloadDtoNo-This parameter is required when the authentication method is PASSCODE.{"email":"test@example.com","passCode":"passw0rd"}
adPayloadSignInByAdPayloadDtoNo-This parameter is required when the authentication method is AD.{"sAMAccountName":"test","password":"passw0rd"}
ldapPayloadSignInByLdapPayloadDtoNo-This parameter is required when the authentication method is LDAP.{"sAMAccountName":"test","password":"passw0rd"}
optionsSignInOptionsDtoNo-Optional parameters{"passwordEncryptType":"none"}
client_idstringNo-Application ID. When the "token exchange authentication method" configuration of the application is client_secret_post, this parameter is required.6342b8537axxxx047d314109
client_secretstringNo-Application secret key. When the "token exchange authentication method" configuration of the application is client_secret_post, this parameter is required.4203d30e5e915xxxxxx26c31c9adce68

¶ Request response

Type: LoginTokenRespDto

NameTypeDescription
statusCodenumberBusiness status code, which can be used to determine whether the operation is successful. 200 means success.
messagestringDescription
apiCodenumberSegmented error code, which can be used to get the specific error type (successful request does not return). For a detailed list of error codes, please see: API Code List (opens new window)
requestIdstringRequest ID. Returned when the request fails.
dataLoginTokenResponseDataDtoResponse data

Example results:

{
  "statusCode": 200,
  "message": "Success",
  "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c",
  "data": {
    "scope": "openid profile",
    "access_token": "eyJhbGciOiJSxxxxx",
    "id_token": "eyJhbGxxxx",
    "refresh_token": "WPsGJbvpBjqXz6IJIr1UHKyrdVF",
    "token_type": "bearer",
    "expire_in": 7200
  }
}

¶ Data structure

¶ SignInByPasswordPayloadDto

NameType
Is it required?
Description
Sample value
passwordstringYesUser password, not encrypted by default. All GenAuth APIs transmit passwords securely via the HTTPS protocol, which can ensure security to a certain extent.
If you need a higher level of security, we also support RSA256 and the national secret SM2 password encryption methods. For details, see the optional parameter options.passwordEncryptType.
passw0rd
accountstringNoUser account (username/phone number/email address)test
emailstringNoEmail address, case insensitive.test@example.com
usernamestringNoUsername (username)test
phonestringNoPhone number188xxxx8888

¶ SignInByPassCodePayloadDto

NameType
Required
Description
Sample value
passCodestringYesA one-time temporary verification code. You need to first call the send SMS or send email interface to obtain the verification code.123456
emailstringNoEmail address, case insensitive.114114
phonestringNoMobile phone number188xxxx8888
phoneCountryCodestringNoMobile phone area code. This field is optional for mobile phone numbers in mainland China. The GenAuth SMS service does not currently support international mobile phone numbers. You need to configure the corresponding international SMS service in the GenAuth console. A complete list of mobile phone area codes can be found at https://en.wikipedia.org/wiki/List_of_country_calling_codes.+86

¶ SignInByAdPayloadDto

NameType
Required
Description
Sample value
passwordstringYesUser password, unencrypted by default. All GenAuth APIs transmit passwords securely via HTTPS, which can ensure security to a certain extent.
If you need a higher level of security, we also support RSA256 and national secret SM2 password encryption methods. For details, see the optional parameter options.passwordEncryptType.
passw0rd
sAMAccountNamestringYessAMAccountName of the account in the Windows AD user directorytest

¶ SignInByLdapPayloadDto

NameType
Is it required?
Description
Sample value
passwordstringYesUser password, unencrypted by default. All GenAuth APIs transmit passwords securely via HTTPS, which can ensure security to a certain extent.
If you need a higher level of security, we also support RSA256 and national secret SM2 password encryption methods. For details, see the optional parameter options.passwordEncryptType.
passw0rd
sAMAccountNamestringYessAMAccountName of the account in the LDAP AD user directory114114

¶ SignInOptionsDto

NameType
Is this field required?
Description
Sample value
scopestringnoThe permissions that need to be requested, must include openid. If you need to obtain the mobile phone number and email, you need to include phone email; if you need refresh_token, you need to include offline_access. Please separate multiple scopes with spaces. The decoded content of id_token will contain the user information related fields corresponding to these scopes.
- openid: Must be included.
- profile: Returns birthdate, family_name, gender, given_name, locale, middle_name, name, nickname, picture, preferred_username, profile, updated_at, website, zoneinfo fields.
- username: Returns username.
- email: Returns email, email_verified.
- phone: Returns phone_number, phone_number_verified.
- offline_access: If this parameter exists, the token interface will return the refresh_token field.
- roles: Returns the user's role list.
- external_id: User ID of the original system.
- extended_fields: Returns the user's extended field information, the content is an object, the key is the extended field name, the value is the extended field value.
- tenant_id: Returns the user's tenant ID.
openid profile
clientIpstringNoThe real IP address of the client. By default, GenAuth will identify the IP address of the request source as the IP address of the user's login. If you call this interface in the backend server, you need to set this IP to the user's real request IP.192.168.0.1
contextobjectNoAdditional request context, which will be passed to the context object of Pipeline (opens new window) before and after authentication. Learn how to get additional context passed in to the context parameter of Pipeline.​​{"source":"utm"}
tenantIdstringNoTenant ID625783d629f2bd1f5ddddd98c
customDataobjectNoTo set additional user custom data, you need to configure custom data (opens new window) in the GenAuth console first.{"school":"pku","age":"20"}
autoRegisterbooleanNoWhether to enable automatic registration. If set to true, an account will be automatically created for the user if it does not exist. Note: This parameter is only valid for the specified username and password, email password, and mobile phone number password. This parameter cannot be set for general account passwords.
captchaCodestringNoCaptcha graphic verification code, case-insensitive. When the security policy is set to verification code and the limit on failed logins is triggered, you will need to fill in the graphic verification code for the next login.a8nz
passwordEncryptTypestringNoPassword encryption type, supports RSA256 and SM2 algorithms. The default is none, no encryption.
- none: Do not encrypt the password, use plain text for transmission.
- rsa: Use RSA256 algorithm to encrypt the password, you need to use the RSA public key of the GenAuth service for encryption, please read the Introduction section to learn how to obtain the RSA256 public key of the GenAuth service.
- sm2: Use SM2 algorithm (opens new window) to encrypt the password, you need to use the SM2 public key of the GenAuth service for encryption, please read the Introduction section to learn how to obtain the SM2 public key of the GenAuth service.
sm2

¶ LoginTokenResponseDataDto

NameType
Is it required?
Description
Sample value
scopestringNoScope corresponding to access_tokenopenid profile
access_tokenstringNoAPI call credentials, authorized to access resource API within a limited timeeyJhbGciOiJSxxxxx
id_tokenstringNoUser's identity credentials, which will contain user information after parsingeyJhbGxxxx
refresh_tokenstringNorefresh_token is used to obtain a new AccessTokenWPsGJbvpBjqXz6IJIr1UHKyrdVF
token_typestringYestoken typebearer
expire_innumberyesexpiration time in seconds7200
Previous article: Login with AD Account Next article: Login with Mobile Social Login
  • Method name
  • Request parameters
  • Request response
  • Data structure

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.