Closed maximedegreve closed 7 years ago
In that case you probably need to remove the "&" before "code" too. If it exists. Great work on this repo btw!
I'm sorry I thought you could store things int he redirect url but reading the docs you can't do this with Oauth.
You should be able to store stuff in the state parameter in OAuth! This is just a convenience method for Turnstile to do the token exchange, though -- you can always grab stuff from the state if you feel that it's necessary.
Glad you find Turnstile useful!
In func exchange(authorizationCodeCallbackURL url: String, state: String) throws -> OAuth2Token {
I think you should use: let redirectURL = url.substring(to: url.range(of: "code")?.lowerBound ?? url.startIndex)
because if you take for the redirection url everything under ? then you end up with a url that doesn't include additional parameters that could have been added in that url.
e.g.."http://0.0.0.0:8080/login-with-facebook/consumer?normal=true normal = true will get cut off