Hanzo
PlatformHanzo IAMProvidersOAuth

Alipay OAuth

Add Alipay as an OAuth provider (certificate-based).

You need an Alipay Open Platform developer account. See preparation before access.

Get APPID and certificates

APPID

Create an application in the Alipay Open Platform console and note the APPID. See APPID query guide.

Certificates

Generate an RSA2 key pair per Alipay docs. You get appPrivateKey.txt and appPublicKey.txt. Upload the app certificate in the Alipay app and download: alipayRootCert.crt, appCertPublicKey.crt, alipayCertPublicKey.crt.

In Hanzo IAM Certs, create two certs:

App Cert

Hanzo IAM fieldValue
Typex509
Certificatecontent of appCertPublicKey.crt
Private keycontent of appPrivateKey.txt

Root Cert

Hanzo IAM fieldValue
Typex509
Certificatecontent of alipayCertPublicKey.crt
Private keycontent of alipayRootCert.crt

:::info In Alipay, the callback URL must be Hanzo IAM’s callback URL. In Hanzo IAM, the application Redirect URL is your application’s callback URL. See Application config. :::

Create the Alipay OAuth provider in Hanzo IAM

ProvidersAdd. Set Category to OAuth, Type to Alipay. Fill Client ID with the APPID and select the App Cert and Root Cert you created.

Troubleshooting

If you see "asn1: syntax error: sequence truncated" or login failures:

  1. App Cert: Certificate = appCertPublicKey.crt, Private key = appPrivateKey.txt.
  2. Root Cert: Certificate = alipayCertPublicKey.crt, Private key = alipayRootCert.crt.
  3. APPID matches the Alipay application.
  4. Callback URL is set correctly in both Alipay and Hanzo IAM.

How is this guide?

Last updated on

On this page