我在http中的这个方法在OAuth完成身份验证后被触发。基本上我的应用程序被重定向到本机应用程序进行身份验证,但是我需要将收到的信息发送到后端。所以我做了这个功能。
func sendAuth() {
if let url = NSURL(string: "https://xxxxxx/api/v1/integrations/xxxx/auth"){
let request = NSMutableURLRequest(URL: url)
let session = ServicesUtils.BaseSessionManager()
request.HTTPMethod = "POST"
let token = AccessToken?()
let json = ["token" : (token?.tokenString)!, "refresh_token" : (token?.refreshToken)!, "expires_in" : (token?.expirationDate)!, "user_id" : "user_uuid" , "token_type" : "Bearer"] as Dictionary <String,AnyObject>
let data: NSData = NSKeyedArchiver.archivedDataWithRootObject(json)
request.HTTPBody = data
session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
}).resume()
}
如何在重定向回到我的应用程序后抛出此功能?