 			let a = NSURL(string: OAUTH2_LOGIN_URL)!
 			let b = NSURL(string: "https://accounts.google.com/o/oauth2/approval")!
 			auth(a, b, { request in
-				// MANAGER DATATASK
-				manager.request(request).responseData { response in
-					let body = NSString(data: response.result.value!, encoding: NSUTF8StringEncoding)!
-					let auth_code = Regex("value=\"(.+?)\"").match(body as String).first!
-					
-					//  - first: authenticate(auth_code)
-					authenticate(auth_code, cb: { (access_token, refresh_token) in
-						saveTokens(access_token, refresh_token: refresh_token)
-						cb(client: Client(manager: manager))
-					})
-				}
+				
+				manager.session.dataTaskWithRequest(request) { data, reponse, error in
+					if let error = error { // error case
+						print("Request failed with error: \(error)")
+					} else {
+						let body = NSString(data: data!, encoding: NSUTF8StringEncoding)!
+						let auth_code = Regex("value=\"(.+?)\"").match(body as String).first!
+						
+						//  - first: authenticate(auth_code)
+						authenticate(auth_code, cb: { (access_token, refresh_token) in
+							saveTokens(access_token, refresh_token: refresh_token)
+							cb(client: Client(manager: manager))
+						})
+					}
+				}.resume()
 			})
 		}
 	}

				let url = "https://accounts.google.com/accounts/OAuthLogin?source=hangups&issueuberauth=1"
				let request = NSMutableURLRequest(URL: NSURL(string: url)!)
				request.setValue("Bearer \(access_token)", forHTTPHeaderField: "Authorization")
				// MANAGER DATATASK
				manager.request(request).responseData { response in
					var uberauth = NSString(data: response.result.value!, encoding: NSUTF8StringEncoding)! as String
					uberauth.replaceRange(Range<String.Index>(
						start: uberauth.endIndex.advancedBy(-1),
						end: uberauth.endIndex
						), with: "")
					
					let request = NSMutableURLRequest(URL: NSURL(string: "https://accounts.google.com/MergeSession")!)
					request.setValue("Bearer \(access_token)", forHTTPHeaderField: "Authorization")
					// MANAGER DATATASK
					manager.request(request).responseData { response in
						let url = "https://accounts.google.com/MergeSession?service=mail&continue=http://www.google.com&uberauth=\(uberauth)"
						let request = NSMutableURLRequest(URL: NSURL(string: url)!)
						request.setValue("Bearer \(access_token)", forHTTPHeaderField: "Authorization")
						// MANAGER DATATASK
						manager.request(request).responseData { response in
							cb(client: Client(manager: manager))
						}
					}
				}
			}
		} else {
			

				"refresh_token": refresh_token,
			]
			
			// Make request first.
			let req = NSMutableURLRequest(URL: NSURL(string: OAUTH2_TOKEN_REQUEST_URL)!)
			req.HTTPMethod = "POST"
			req.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
			req.HTTPBody = query(token_request_data).dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
			
			manager.session.dataTaskWithRequest(req) { data, reponse, error in
				if let error = error { // error case
					print("Request failed with error: \(error)")
				} else {
					do {
						let JSON = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments)
						print("got \(JSON)")
						cb(access_token: JSON["access_token"] as! String, refresh_token: refresh_token)
					} catch {
						print("Request failed with error: \(error)")
					}
				}
			}.resume()
	}
	
	public class func authenticateClient(cb: (client: Client) -> Void, auth: Authenticator) {
