summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauth2authorizationcodeflow.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-01-21 17:39:10 +0100
committerMarc Mutz <marc.mutz@qt.io>2025-01-22 07:24:32 +0000
commit83f8e443960c3c22a0820a8da341ec6640633c1e (patch)
treee5d406ea00b60ab18aec83f807f9faa807d5a973 /src/oauth/qoauth2authorizationcodeflow.cpp
parent4e92bf73c6adbd477bcd922df85237d4487f7877 (diff)
QAbstractOAuthPrivate: rename generateRandomString -> generateRandomBase64String
This makes it clear that the result is Base-64 encoded, therefore ASCII, and that fromUtf8() is not needed. Consequently, remove one fromUtf8() called on its result, and replace it with fromLatin1(). Amends 90d5571d02887a8f61ec767699bb05c76c437153. Pick-to: 6.9 6.8 6.5 Change-Id: Ie95d6b4b5fecaa089fd00ab7ee617567d00b381c Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
-rw-r--r--src/oauth/qoauth2authorizationcodeflow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp
index 01e2385..fefb459 100644
--- a/src/oauth/qoauth2authorizationcodeflow.cpp
+++ b/src/oauth/qoauth2authorizationcodeflow.cpp
@@ -160,12 +160,12 @@ QByteArray QOAuth2AuthorizationCodeFlowPrivate::createPKCEChallenge()
case QOAuth2AuthorizationCodeFlow::PkceMethod::Plain:
// RFC 7636 4.2, plain
// code_challenge = code_verifier
- pkceCodeVerifier = generateRandomString(pkceVerifierLength);
+ pkceCodeVerifier = generateRandomBase64String(pkceVerifierLength);
return pkceCodeVerifier;
case QOAuth2AuthorizationCodeFlow::PkceMethod::S256:
// RFC 7636 4.2, S256
// code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))
- pkceCodeVerifier = generateRandomString(pkceVerifierLength);
+ pkceCodeVerifier = generateRandomBase64String(pkceVerifierLength);
// RFC 7636 3. Terminology:
// "with all trailing '=' characters omitted"
return QCryptographicHash::hash(pkceCodeVerifier, QCryptographicHash::Algorithm::Sha256)