I'm using OAuthSwift, it works perfectly, but when I click on my Login button, it opens a new Safari page. I would like to open the URL in-app, but I'm beginning and I don't know how do that.
My code :
@IBAction func loginButton(sender: AnyObject) {
doOAuthDribbble()
}
func doOAuthDribbble(){
let oauthswift = OAuth2Swift(
consumerKey: Dribbble["consumerKey"]!,
consumerSecret: Dribbble["consumerSecret"]!,
authorizeUrl: "https://dribbble.com/oauth/authorize",
accessTokenUrl: "https://dribbble.com/oauth/token",
responseType: "code"
)
oauthswift.authorizeWithCallbackURL( NSURL(string: "dribs://oauth-callback/dribbble")!, scope: "public+write+comment+upload", state: "", success: {
credential, response in
// Get User
var parameters = Dictionary<String, AnyObject>()
oauthswift.client.get("https://api.dribbble.com/v1/user?access_token=\(credential.oauth_token)", parameters: parameters,
success: {
data, response in
let jsonDict: AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil)
println(jsonDict)
}, failure: {(error:NSError!) -> Void in
println(error)
})
}, failure: {(error:NSError!) -> Void in
println(error.localizedDescription)
})
}
My Login Page
then, the new safari page
In viewDidLoad()
of your WebViewController.swift
myUrl = someurl
myWebView.loadRequest(NSURLRequest(URL: NSURL(string: myUrl)!))