generateCodeChallenge
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
Param | Data type | Description |
---|---|---|
codeVerifier | string | The code verifier string that was generated previously using generateCodeVerifier. This is used to generate the code challenge. |
Return Value
Param | Data type | Description |
---|---|---|
codeChallenge | string | This 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"
}
}