 				if let loginURL = OAuth2Manager.sharedInstance.authorizationURL, window = self.window {
 				
 					// Replace current root view controller with Safari view controller for login
-					let loginVC = LoginViewController(URL: loginURL)
-					loginVC.replacedRootViewController = window.rootViewController
+					let loginVC = self.createLoginViewController(URL: loginURL)
+					if let loginVC = loginVC as? LoginViewControllerable {
+						loginVC.replacedRootViewController = window.rootViewController
+					}
 					window.rootViewController = loginVC
 				}
 				fulfill()

	
	public var loggingIn: Bool {
		get {
			if let _ = window?.rootViewController as? LoginViewController {
				return true
			}
			else {

		}
			
		// Replace current root view controller with Safari view controller for login
		let loginVC = createLoginViewController(URL: loginURL)
		if let loginVC = loginVC as? LoginViewControllerable {
			loginVC.replacedRootViewController = window.rootViewController
		}
		window.rootViewController = loginVC
	}
	
