Skip to main content

generateCodeChallenge

Note
Please contact Zalopay Team to be granted permission to use this functionality.

Mô tả​

This function generates a code challenge for PKCE (Proof Key for Code Exchange) based OAuth 2.0 authorization flows. This is used to securely exchange authorization codes in OAuth 2.0 flows.

Parameters​

ParamData typeDescription
codeVerifierstringThe code verifier string that was generated previously using generateCodeVerifier. This is used to generate the code challenge.

Return Value​

ParamData typeDescription
codeChallengestringThis is a cryptographically random string using the characters A-Z, a-z, 0-9, and the punctuation characters -._~

Error Code​

Sample Code and Sample Return Data​

Sample Request:

window.zlpSdk.User
.generateCodeChallenge({ codeVerifier: uMi-fNS-HQW4dPKUdJqX9XaRweKh-FlKYzpemo0j.y7 })
.then((response) => console.log(response))
.catch((error) => console.error(error.errorCode));

Sample Response:

{
"status": "success",
"data": {
"codeChallenge": "CbbHiWz9N0ALnJetIlOrVkeT1CHEpYehTqxSYU_1SO8"
}
}