   }()
   fileprivate var networkManager: Alamofire.SessionManager = .default
   // MARK: - Public
-  var authorizationURL: URL? {
+  
+  struct authorisationUrl{
+    
+    var clientSideFlowUrl: URL? {
     let parameters: [String : Any] = [Instagram.Keys.Auth.clientId: Instagram.Constants.appClientId,
                                       Instagram.Keys.Auth.redirectUri: Instagram.Constants.appRedirectURL,
                                       Instagram.Keys.Response.type: Instagram.Keys.Response.token,
                                       Instagram.Keys.Response.scope: Instagram.LoginScope.allScopesValue]
-    return BaseNetworkClient.encode(Instagram.Constants.baseUrl + "oauth/authorize/", parameters: parameters)
+    return InstagramClient().encode(Instagram.Constants.baseUrl + "oauth/authorize/", parameters: parameters)
+    }
+
+    var sereverSideFlowUrl: URL? {
+    let parameters: [String : Any] = [Instagram.Keys.Auth.clientId: Instagram.Constants.appClientId,
+                                      Instagram.Keys.Auth.redirectUri: Instagram.Constants.appRedirectURL,
+                                      Instagram.Keys.Response.type: Instagram.Keys.Response.code,
+                                      Instagram.Keys.Response.scope: Instagram.LoginScope.allScopesValue]
+    return InstagramClient().encode(Instagram.Constants.baseUrl + "oauth/authorize/", parameters: parameters)
+    }
   }
-  //swiftlint:disable:next line_length
-  func send<T : AnyInstagramResponse>(_ router: AnyInstagramNetworkRouter, completion: @escaping (T?, Error?) -> (Void)) {
+  
+    func send<T : AnyInstagramResponse>(_ router: AnyInstagramNetworkRouter, completion: @escaping (T?, Error?) -> (Void)) {
     do {
       guard let accessToken = keychainStore[Instagram.Keys.Auth.accessToken] else {
         completion(nil, nil)
         return
       }
       let request = try router.asURLRequest(withAccessToken: accessToken)
+    
+
       networkManager.request(request).validate().responseObject(completionHandler: { (response: DataResponse<T>) in
         // TODO: Need to setup check on access token expire
-        completion(response.value, response.error)
+        completion(response.data, response.e)
       })
     } catch {
       completion(nil, error)

    static let accessTokenExpired = "InstagramClientMediaAccessTokenExpired"
  }
}

import SafariServices
import KeychainAccess
import Alamofire
import AlamofireObjectMapper

public enum Instagram {}

private let instagramManagerKeychainStore = "com.InstagramClient.keychainStore"

public enum InstagramAuthUrlFragment{
  case empty
  case code(String)
  case accessToken(String)
}

final class InstagramClient {
  // MARK: - Properties
