generateCodeChallenge creates a code challenge from a given code verifier. The challenge is derived by taking the SHA256 hash of the verifier and then Base64 URL-encoding the result. This is sent in the initial authorization request and later verified against the verifier.
(codeVerifier string)
| 51 | // Base64 URL-encoding the result. This is sent in the initial authorization |
| 52 | // request and later verified against the verifier. |
| 53 | func generateCodeChallenge(codeVerifier string) string { |
| 54 | hash := sha256.Sum256([]byte(codeVerifier)) |
| 55 | return base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(hash[:]) |
| 56 | } |