Skip to content

Commit f06928b

Browse files
fix: email link fix to decoding link
1 parent 1d9d8dc commit f06928b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,19 @@ public extension AuthService {
427427
throw AuthServiceError
428428
.invalidEmailLink("email address is missing from app storage. Is this the same device?")
429429
}
430-
let link = url.absoluteString
430+
let urlString = url.absoluteString
431+
432+
// Extract the actual auth link from Firebase Dynamic Link
433+
guard let dynamicLink = CommonUtils.getQueryParamValue(from: urlString, paramName: "link") else {
434+
throw AuthServiceError
435+
.invalidEmailLink("Dynamic Link 'link' parameter is missing from the email link URL")
436+
}
437+
438+
guard let link = dynamicLink.removingPercentEncoding else {
439+
throw AuthServiceError
440+
.invalidEmailLink("Failed to decode Link URL")
441+
}
442+
431443
guard let continueUrl = CommonUtils.getQueryParamValue(from: link, paramName: "continueUrl")
432444
else {
433445
throw AuthServiceError

0 commit comments

Comments
 (0)