diff --git a/Sources/HexavilleAuth/Providers/OAuth2/FacebookAuthorizationProvider.swift b/Sources/HexavilleAuth/Providers/OAuth2/FacebookAuthorizationProvider.swift index 7b34e5b..5d6164a 100644 --- a/Sources/HexavilleAuth/Providers/OAuth2/FacebookAuthorizationProvider.swift +++ b/Sources/HexavilleAuth/Providers/OAuth2/FacebookAuthorizationProvider.swift @@ -21,7 +21,7 @@ public struct FacebookAuthorizationProvider: OAuth2AuthorizationProvidable { public let callback: RespodWithCredential - public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential) { + public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, blockForCallbackURLQueryParams: ((Request) -> [URLQueryItem])? = nil, scope: String, callback: @escaping RespodWithCredential) { self.path = path self.oauth = OAuth2( @@ -30,6 +30,7 @@ public struct FacebookAuthorizationProvider: OAuth2AuthorizationProvidable { authorizeURL: "https://www.facebook.com/dialog/oauth", accessTokenURL: "https://graph.facebook.com/oauth/access_token", callbackURL: callbackURL, + blockForCallbackURLQueryParams: blockForCallbackURLQueryParams, scope: scope ) diff --git a/Sources/HexavilleAuth/Providers/OAuth2/GithubAuthorizationProvider.swift b/Sources/HexavilleAuth/Providers/OAuth2/GithubAuthorizationProvider.swift index fa7612c..e98c0c7 100644 --- a/Sources/HexavilleAuth/Providers/OAuth2/GithubAuthorizationProvider.swift +++ b/Sources/HexavilleAuth/Providers/OAuth2/GithubAuthorizationProvider.swift @@ -21,7 +21,7 @@ public struct GithubAuthorizationProvider: OAuth2AuthorizationProvidable { public let callback: RespodWithCredential - public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential) { + public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, blockForCallbackURLQueryParams: ((Request) -> [URLQueryItem])? = nil, scope: String, callback: @escaping RespodWithCredential) { self.path = path self.oauth = OAuth2( @@ -30,6 +30,7 @@ public struct GithubAuthorizationProvider: OAuth2AuthorizationProvidable { authorizeURL: "http://github.com/login/oauth/authorize", accessTokenURL: "https://github.com/login/oauth/access_token", callbackURL: callbackURL, + blockForCallbackURLQueryParams: blockForCallbackURLQueryParams, scope: scope ) diff --git a/Sources/HexavilleAuth/Providers/OAuth2/GoogleAuthorizationProvider.swift b/Sources/HexavilleAuth/Providers/OAuth2/GoogleAuthorizationProvider.swift index 9397847..9db02a4 100644 --- a/Sources/HexavilleAuth/Providers/OAuth2/GoogleAuthorizationProvider.swift +++ b/Sources/HexavilleAuth/Providers/OAuth2/GoogleAuthorizationProvider.swift @@ -17,7 +17,7 @@ public struct GoogleAuthorizationProvider: OAuth2AuthorizationProvidable { public let callback: RespodWithCredential - public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential) { + public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, blockForCallbackURLQueryParams: ((Request) -> [URLQueryItem])? = nil, scope: String, callback: @escaping RespodWithCredential) { self.path = path self.oauth = OAuth2( @@ -26,6 +26,7 @@ public struct GoogleAuthorizationProvider: OAuth2AuthorizationProvidable { authorizeURL: "https://accounts.google.com/o/oauth2/auth", accessTokenURL: "https://accounts.google.com/o/oauth2/token", callbackURL: callbackURL, + blockForCallbackURLQueryParams: blockForCallbackURLQueryParams, scope: scope ) diff --git a/Sources/HexavilleAuth/Providers/OAuth2/InstagramAuthorizationProvider.swift b/Sources/HexavilleAuth/Providers/OAuth2/InstagramAuthorizationProvider.swift index ce1f625..eb15ae0 100644 --- a/Sources/HexavilleAuth/Providers/OAuth2/InstagramAuthorizationProvider.swift +++ b/Sources/HexavilleAuth/Providers/OAuth2/InstagramAuthorizationProvider.swift @@ -17,7 +17,7 @@ public struct InstagramAuthorizationProvider: OAuth2AuthorizationProvidable { public let callback: RespodWithCredential - public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential) { + public init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, blockForCallbackURLQueryParams: ((Request) -> [URLQueryItem])? = nil, scope: String, callback: @escaping RespodWithCredential) { self.path = path self.oauth = OAuth2( @@ -26,6 +26,7 @@ public struct InstagramAuthorizationProvider: OAuth2AuthorizationProvidable { authorizeURL: "https://api.instagram.com/oauth/authorize", accessTokenURL: "https://api.instagram.com/oauth/access_token", callbackURL: callbackURL, + blockForCallbackURLQueryParams: blockForCallbackURLQueryParams, scope: scope ) diff --git a/Sources/HexavilleAuth/Providers/OAuth2AuthorizationProvidable.swift b/Sources/HexavilleAuth/Providers/OAuth2AuthorizationProvidable.swift index 6211460..48e20a2 100644 --- a/Sources/HexavilleAuth/Providers/OAuth2AuthorizationProvidable.swift +++ b/Sources/HexavilleAuth/Providers/OAuth2AuthorizationProvidable.swift @@ -15,7 +15,7 @@ public protocol OAuth2AuthorizationProvidable { var path: String { get } var oauth: OAuth2 { get } var callback: RespodWithCredential { get } - init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, scope: String, callback: @escaping RespodWithCredential) + init(path: String, consumerKey: String, consumerSecret: String, callbackURL: CallbackURL, blockForCallbackURLQueryParams: ((Request) -> [URLQueryItem])?, scope: String, callback: @escaping RespodWithCredential) func getAccessToken(for: Request) throws -> Credential func authorize(for: Request) throws -> (Credential, LoginUser) }