Last active
March 8, 2021 15:35
-
-
Save markvanwijnen/8515507a1b124d06d68104c3acf5c320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func oAuthSignatureBaseString(httpMethod: String, | |
baseURLString: String, | |
parameters: [URLQueryItem]) -> String { | |
var parameterComponents: [String] = [] | |
for parameter in parameters { | |
let name = parameter.name.oAuthURLEncodedString | |
let value = parameter.value?.oAuthURLEncodedString ?? "" | |
parameterComponents.append("\(name)=\(value)") | |
} | |
let parameterString = parameterComponents.sorted().joined(separator: "&") | |
return httpMethod + "&" + | |
baseURLString.oAuthURLEncodedString + "&" + | |
parameterString.oAuthURLEncodedString | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment