         self.redirectUri = redirectUri
         self.scope = scope
     }
-    
+
     // MARK: - Oauth2Provider
-    
+
     /// Provider authorization.
     public var authorization: Authorization {
         get {

import NSURL_QueryDictionary

public struct UnsplashProvider: OAuth2Provider {
    
    // MARK: - Attributes
    
    fileprivate let clientId: String
    fileprivate let clientSecret: String
    fileprivate let redirectUri: String
    fileprivate let scope: [String]
    fileprivate let responseType: String = "code"
    
    // MARK: - Init
    
    public init(clientId: String,
                clientSecret: String,
                redirectUri: String,

    public var sessionAdapter: SessionAdapter = { (data,  _) -> OAuth2Session? in
        let json = try? JSONSerialization.jsonObject(with: data, options: [])
        guard let dictionary = json as? [String: String] else { return nil }
        let token = dictionary["access_token"]
        let refresh = dictionary["refresh_token"]
        return token.map {OAuth2Session(accessToken: $0, refreshToken: refresh)}
    }

}
