Skip to content

Commit b4ba49e

Browse files
authored
fix(auth): resolve format string mismatch in ASF timestamp generation (#4095)
Fixes #4073 Changed timestamp generation in CognitoUserPoolASF.prepareJsonPayload to use Int64 instead of Double to match the %lli format specifier. This resolves the format string mismatch warning that was appearing during sign-in operations. The issue was caused by floor() returning a Double while the format string expected an Int64. Converting directly to Int64 maintains the same functionality while eliminating the type mismatch.
1 parent 8536147 commit b4ba49e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct CognitoUserPoolASF: AdvancedSecurityBehavior {
8686
contextData: [String: String],
8787
userPoolId: String
8888
) throws -> String {
89-
let timestamp = String(format: "%lli", floor(Date().timeIntervalSince1970 * 1_000))
89+
let timestamp = String(format: "%lli", Int64(Date().timeIntervalSince1970 * 1_000))
9090
let payload = [
9191
"contextData": contextData,
9292
"username": username,

0 commit comments

Comments
 (0)