Alipay
To set up the Alipay OAuth provider, you need to have a developer account at Alipay Open Platform and configure OAuth application credentials.
Step 1. Preparation
First, you need to have a developer account at Alipay Open Platform.
Before accessing Alipay OAuth, there are some preparations that need to be done.
You can refer to the documentation preparation before access for more information.
1.1 Get APPID
Login to the Alipay Open Platform Console and create an application.
How to get the APPID: Alipay APPID Query Guide
1.2 Configure Cert
Generate an RSA2 certificate based on the document and then you can obtain the appPrivateKey.txt and appPublicKey.txt.
Upload the certificate to the application and then you can download three files: alipayRootCert.crt, appCertPublicKey.crt, alipayCertPublicKey.crt.
Create a Cert called App Cert at Casdoor:
| Name | Name in Alipay |
|---|---|
| Type | choose x509 |
| Certificate | content of appCertPublicKey.crt |
| Private key | content of appPrivateKey.txt |
Create a Cert called Root Cert at Casdoor:
| Name | Name in Alipay |
|---|---|
| Type | choose x509 |
| Certificate | content of alipayCertPublicKey.crt |
| Private key | content of alipayRootCert.crt |
In the Alipay App config, the callback URL must be your Casdoor's callback URL, and the Redirect URL in Casdoor should be your application's callback URL.
For more details, please read App config.
Step 2. Create an Alipay OAuth provider
Next, create an Alipay OAuth provider in Casdoor by filling in the necessary information.
| Name | Name in Alipay |
|---|---|
| Category | choose OAuth |
| Type | choose Alipay |
| Client ID | APPID obtained from Step 1.1 |
| Cert | App Cert configured at Step 1.2 |
| Root Cert | Root Cert configured at Step 1.2 |
Add the Alipay OAuth provider and fill in the Client ID (APPID), select the Cert and Root Cert in your Casdoor.
Now you can use Alipay as a third-party service to complete authentication.
Troubleshooting
If you encounter errors during the login process, such as "asn1: syntax error: sequence truncated", please verify that:
- The certificates are correctly configured in Casdoor
- The App Cert contains the content of
appCertPublicKey.crtin the Certificate field andappPrivateKey.txtin the Private key field - The Root Cert contains the content of
alipayCertPublicKey.crtin the Certificate field andalipayRootCert.crtin the Private key field - The APPID matches the application you created in Alipay Open Platform
- The callback URL is correctly configured in both Alipay and Casdoor
For more information about Alipay OAuth, please visit the Alipay Open Platform documentation.