diff --git a/Sources/CustomAuth/Handlers/DiscordLoginHandler.swift b/Sources/CustomAuth/Handlers/DiscordLoginHandler.swift index 94f83d7..6604daf 100644 --- a/Sources/CustomAuth/Handlers/DiscordLoginHandler.swift +++ b/Sources/CustomAuth/Handlers/DiscordLoginHandler.swift @@ -20,10 +20,12 @@ class DiscordLoginHandler: AbstractLoginHandler { override public func setFinalUrl() throws { var urlComponents = URLComponents() - var params: [String: String] = if jwtParams != nil { try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) - } else { - [:] + var params: [String: String] = [:] + + if jwtParams != nil { + params = try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) } + params.merge([ "state": try state(), "response_type": response_type, diff --git a/Sources/CustomAuth/Handlers/FacebookLoginHandler.swift b/Sources/CustomAuth/Handlers/FacebookLoginHandler.swift index 145f827..503c8ba 100644 --- a/Sources/CustomAuth/Handlers/FacebookLoginHandler.swift +++ b/Sources/CustomAuth/Handlers/FacebookLoginHandler.swift @@ -19,10 +19,12 @@ class FacebookLoginHandler: AbstractLoginHandler { override public func setFinalUrl() throws { var urlComponents = URLComponents() - var params: [String: String] = if jwtParams != nil { try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) - } else { - [:] + var params: [String: String] = [:] + + if jwtParams != nil { + params = try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) } + params.merge([ "state": try state(), "response_type": response_type, diff --git a/Sources/CustomAuth/Handlers/GoogleLoginHandler.swift b/Sources/CustomAuth/Handlers/GoogleLoginHandler.swift index 3094c43..d3d748c 100644 --- a/Sources/CustomAuth/Handlers/GoogleLoginHandler.swift +++ b/Sources/CustomAuth/Handlers/GoogleLoginHandler.swift @@ -19,10 +19,12 @@ class GoogleLoginHandler: AbstractLoginHandler { override public func setFinalUrl() throws { var urlComponents = URLComponents() - var params: [String: String] = if jwtParams != nil { try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) - } else { - [:] + var params: [String: String] = [:] + + if jwtParams != nil { + params = try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) } + params.merge([ "state": try state(), "response_type": response_type, diff --git a/Sources/CustomAuth/Handlers/RedditLoginHandler.swift b/Sources/CustomAuth/Handlers/RedditLoginHandler.swift index d1e6496..9df1709 100644 --- a/Sources/CustomAuth/Handlers/RedditLoginHandler.swift +++ b/Sources/CustomAuth/Handlers/RedditLoginHandler.swift @@ -17,10 +17,12 @@ class RedditLoginHandler: AbstractLoginHandler { override public func setFinalUrl() throws { var urlComponents = URLComponents() - var params: [String: String] = if jwtParams != nil { try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) - } else { - [:] + var params: [String: String] = [:] + + if jwtParams != nil { + params = try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) } + params.merge([ "state": try state(), "response_type": response_type, diff --git a/Sources/CustomAuth/Handlers/TwitchLoginHandler.swift b/Sources/CustomAuth/Handlers/TwitchLoginHandler.swift index d043817..a1d61b9 100644 --- a/Sources/CustomAuth/Handlers/TwitchLoginHandler.swift +++ b/Sources/CustomAuth/Handlers/TwitchLoginHandler.swift @@ -22,10 +22,12 @@ class TwitchLoginHandler: AbstractLoginHandler { override public func setFinalUrl() throws { var urlComponents = URLComponents() - var params: [String: String] = if jwtParams != nil { try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) - } else { - [:] + var params: [String: String] = [:] + + if jwtParams != nil { + params = try (JSONSerialization.jsonObject(with: try JSONEncoder().encode(jwtParams), options: []) as! [String: String]) } + params.merge([ "state": try state(), "response_type": response_type,