[GH-ISSUE #51] Setting the Callback URL in the app #33

Closed
opened 2026-03-03 16:44:58 +03:00 by kerem · 10 comments
Owner

Originally created by @nabil-takla on GitHub (Apr 12, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/51

I'm new to Xcode and I'm not sure how to set the Callback URL for the Linkedin app in the Linkedin web page or in the Demo app [oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: { ]. I'd appreciate your help!

Originally created by @nabil-takla on GitHub (Apr 12, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/51 I'm new to Xcode and I'm not sure how to set the Callback URL for the Linkedin app in the Linkedin web page or in the Demo app [oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: { ]. I'd appreciate your help!
kerem closed this issue 2026-03-03 16:44:58 +03:00
Author
Owner

@gabriel-jones commented on GitHub (Apr 12, 2015):

As shown in the demo:

func doOAuthInstagram(){
        let oauthswift = OAuth2Swift(
            consumerKey:    Instagram["consumerKey"]!,
            consumerSecret: Instagram["consumerSecret"]!,
            authorizeUrl:   "https://api.instagram.com/oauth/authorize",
            responseType:   "token"
        )

        oauthswift.webViewController = WebViewController()
        oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: {
            credential, response in
            self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)")
            let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)"
            let parameters :Dictionary = Dictionary<String, AnyObject>()
            oauthswift.client.get(url, 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)
        })
    } 
<!-- gh-comment-id:92085221 --> @gabriel-jones commented on GitHub (Apr 12, 2015): As shown in the demo: ``` func doOAuthInstagram(){ let oauthswift = OAuth2Swift( consumerKey: Instagram["consumerKey"]!, consumerSecret: Instagram["consumerSecret"]!, authorizeUrl: "https://api.instagram.com/oauth/authorize", responseType: "token" ) oauthswift.webViewController = WebViewController() oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: { credential, response in self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)") let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)" let parameters :Dictionary = Dictionary<String, AnyObject>() oauthswift.client.get(url, 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) }) } ```
Author
Owner

@nabil-takla commented on GitHub (Apr 12, 2015):

Thanks Gabriel for your quick reply. OAuth1Swift works but OAuth2Swift does not. The following is the code:

———————

func doOAuthLinkedin(){
    var error: NSError?
    let oauthswift = OAuth1Swift(
        consumerKey:    Linkedin["consumerKey"]!,
        consumerSecret: Linkedin["consumerSecret"]!,
        requestTokenUrl: "https://api.linkedin.com/uas/oauth/requestToken",
        authorizeUrl:    "https://api.linkedin.com/uas/oauth/authenticate",
        accessTokenUrl:  "https://api.linkedin.com/uas/oauth/accessToken"
    )
    oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, success: {
        credential, response in
        self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_token_secret:\(credential.oauth_token_secret)")
        var parameters =  Dictionary<String, AnyObject>()
        oauthswift.client.get("https://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),email-address,three-current-positions)", parameters: parameters,
            success: {
                data, response in
                let dataString = NSString(data: data, encoding: NSUTF8StringEncoding                    
                if let xmlDoc = AEXMLDocument(xmlData: data, error: &error) {

                    linkedinProfile[0] = xmlDoc.root["first-name"].value! + " " + xmlDoc.root["last-name"].value!
                    linkedinProfile[1] = xmlDoc.root["picture-urls"]["picture-url"].value!
                    linkedinProfile[2] = xmlDoc.root["three-current-positions"]["position"]["title"].value!
                    linkedinProfile[3] = xmlDoc.root["three-current-positions"]["position"]["company"]["name"].value!
                    linkedinProfile[4] = xmlDoc.root["email-address"].value!

//
println(linkedinProfile)
self.performSegueWithIdentifier("businessCard", sender: nil)

                } else {
                    println("description: \(error?.localizedDescription)\ninfo: \(error?.userInfo)")
                }

            }, failure: {(error:NSError!) -> Void in
                println(error)
        })
        }, failure: {(error:NSError!) -> Void in
            println(error.localizedDescription)
    })
}

//    func doOAuthLinkedin(){
//        let oauthswift = OAuth2Swift(
//            consumerKey:    Linkedin["consumerKey"]!,
//            consumerSecret: Linkedin["consumerSecret"]!,
//            authorizeUrl:   "https://www.linkedin.com/uas/oauth2/authorization",
//            responseType:   "token"
//        )
//        oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: {
//                        credential, response in
//                        self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)")
//                        var parameters =  Dictionary<String, AnyObject>()
//                        oauthswift.client.get("https://api.linkedin.com/v1/people/~", parameters: parameters,
//                            success: {
//                                data, response in
//                                let dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
//                                println(dataString)
//                            }, failure: {(error:NSError!) -> Void in
//                                println(error)
//                        })
//                        }, failure: {(error:NSError!) -> Void in
//                            println(error.localizedDescription)
//                    })
//    }

func showAlertView(title: String, message: String) {
    var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil))
    self.presentViewController(alert, animated: true, completion: nil)
}

———————————
OAuth2Swift is commented out.
What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"?

Nabil

On Apr 12, 2015, at 9:23 AM, gabriel-jones notifications@github.com wrote:

As shown in the demo:

func doOAuthInstagram(){
let oauthswift = OAuth2Swift(
consumerKey: Instagram["consumerKey"]!,
consumerSecret: Instagram["consumerSecret"]!,
authorizeUrl: "https://api.instagram.com/oauth/authorize",
responseType: "token"
)

    oauthswift.webViewController = WebViewController()
    oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: {
        credential, response in
        self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)")
        let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)"
        let parameters :Dictionary = Dictionary<String, AnyObject>()
        oauthswift.client.get(url, 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)
    })
}```


Reply to this email directly or view it on GitHub https://github.com/dongri/OAuthSwift/issues/51#issuecomment-92085221.

<!-- gh-comment-id:92086099 --> @nabil-takla commented on GitHub (Apr 12, 2015): Thanks Gabriel for your quick reply. OAuth1Swift works but OAuth2Swift does not. The following is the code: ——————— ``` func doOAuthLinkedin(){ var error: NSError? let oauthswift = OAuth1Swift( consumerKey: Linkedin["consumerKey"]!, consumerSecret: Linkedin["consumerSecret"]!, requestTokenUrl: "https://api.linkedin.com/uas/oauth/requestToken", authorizeUrl: "https://api.linkedin.com/uas/oauth/authenticate", accessTokenUrl: "https://api.linkedin.com/uas/oauth/accessToken" ) oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, success: { credential, response in self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_token_secret:\(credential.oauth_token_secret)") var parameters = Dictionary<String, AnyObject>() oauthswift.client.get("https://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),email-address,three-current-positions)", parameters: parameters, success: { data, response in let dataString = NSString(data: data, encoding: NSUTF8StringEncoding if let xmlDoc = AEXMLDocument(xmlData: data, error: &error) { linkedinProfile[0] = xmlDoc.root["first-name"].value! + " " + xmlDoc.root["last-name"].value! linkedinProfile[1] = xmlDoc.root["picture-urls"]["picture-url"].value! linkedinProfile[2] = xmlDoc.root["three-current-positions"]["position"]["title"].value! linkedinProfile[3] = xmlDoc.root["three-current-positions"]["position"]["company"]["name"].value! linkedinProfile[4] = xmlDoc.root["email-address"].value! ``` // println(linkedinProfile) self.performSegueWithIdentifier("businessCard", sender: nil) ``` } else { println("description: \(error?.localizedDescription)\ninfo: \(error?.userInfo)") } }, failure: {(error:NSError!) -> Void in println(error) }) }, failure: {(error:NSError!) -> Void in println(error.localizedDescription) }) } // func doOAuthLinkedin(){ // let oauthswift = OAuth2Swift( // consumerKey: Linkedin["consumerKey"]!, // consumerSecret: Linkedin["consumerSecret"]!, // authorizeUrl: "https://www.linkedin.com/uas/oauth2/authorization", // responseType: "token" // ) // oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: { // credential, response in // self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)") // var parameters = Dictionary<String, AnyObject>() // oauthswift.client.get("https://api.linkedin.com/v1/people/~", parameters: parameters, // success: { // data, response in // let dataString = NSString(data: data, encoding: NSUTF8StringEncoding) // println(dataString) // }, failure: {(error:NSError!) -> Void in // println(error) // }) // }, failure: {(error:NSError!) -> Void in // println(error.localizedDescription) // }) // } func showAlertView(title: String, message: String) { var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil)) self.presentViewController(alert, animated: true, completion: nil) } ``` ——————————— OAuth2Swift is commented out. What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"? Nabil > On Apr 12, 2015, at 9:23 AM, gabriel-jones notifications@github.com wrote: > > As shown in the demo: > > func doOAuthInstagram(){ > let oauthswift = OAuth2Swift( > consumerKey: Instagram["consumerKey"]!, > consumerSecret: Instagram["consumerSecret"]!, > authorizeUrl: "https://api.instagram.com/oauth/authorize", > responseType: "token" > ) > > `````` > oauthswift.webViewController = WebViewController() > oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: { > credential, response in > self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)") > let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)" > let parameters :Dictionary = Dictionary<String, AnyObject>() > oauthswift.client.get(url, 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) > }) > }``` > `````` > > — > Reply to this email directly or view it on GitHub https://github.com/dongri/OAuthSwift/issues/51#issuecomment-92085221.
Author
Owner

@gabriel-jones commented on GitHub (Apr 12, 2015):

What do you mean by it doesn't work? Do you get an error from LinkedIn, or does it not respond?

According to the OAuth2 Documentation for LinkedIn your request needs: response type, client id, redirect uri, scope, and state. The scope, I'm guessing you just need to say r_fullprofile. The state can be any random string, just make something up. The documentation also mentions a redirect url, but this should be handled by the library -- it will not have to redirect to a webpage, but will return to your app. The redirect url is actually just the callback url, which is oauth-swift://oauth-callback/linkedin


P.S. to do multi-line comments in Xcode, instead of doing lots of //s for each line, you can write:

/*
Multi
Line
Comment
*/
<!-- gh-comment-id:92133033 --> @gabriel-jones commented on GitHub (Apr 12, 2015): What do you mean by it doesn't work? Do you get an error from LinkedIn, or does it not respond? According to the [OAuth2 Documentation for LinkedIn](https://developer.linkedin.com/docs/oauth2) your request needs: response type, client id, redirect uri, scope, and state. The scope, I'm guessing you just need to say `r_fullprofile`. The state can be any random string, just make something up. The documentation also mentions a redirect url, but this should be handled by the library -- it will not have to redirect to a webpage, but will return to your app. The redirect url is actually just the callback url, which is `oauth-swift://oauth-callback/linkedin` --- P.S. to do multi-line comments in Xcode, instead of doing lots of `//`s for each line, you can write: ``` /* Multi Line Comment */ ```
Author
Owner

@nabil-takla commented on GitHub (Apr 13, 2015):

Thanks. No, it doesn't work. When I use: "oauth-swift://oauth-callback/linkedin", I get an error in Linkedin: "URLs must be http or https"

<!-- gh-comment-id:92187068 --> @nabil-takla commented on GitHub (Apr 13, 2015): Thanks. No, it doesn't work. When I use: "oauth-swift://oauth-callback/linkedin", I get an error in Linkedin: "URLs must be http or https"
Author
Owner

@gabriel-jones commented on GitHub (Apr 13, 2015):

Sorry, I do not know what URL to use. You can directly email the creator of the library: dongri.at@gmail.com

<!-- gh-comment-id:92306772 --> @gabriel-jones commented on GitHub (Apr 13, 2015): Sorry, I do not know what URL to use. You can directly email the creator of the library: dongri.at@gmail.com
Author
Owner

@Ramya797 commented on GitHub (Apr 23, 2015):

I have the same problem for redirect linked URI .. is there a solution ? please let me know
I am using this : oauth-swift://oauth-callback/linkedin but on simulator I get " invalid redirect URI"

<!-- gh-comment-id:95432701 --> @Ramya797 commented on GitHub (Apr 23, 2015): I have the same problem for redirect linked URI .. is there a solution ? please let me know I am using this : oauth-swift://oauth-callback/linkedin but on simulator I get " invalid redirect URI"
Author
Owner

@nabil-takla commented on GitHub (Apr 26, 2015):

Dongri Jin recommended this: https://github.com/dongri/oauthswift.herokuapp.com. It works for me.

<!-- gh-comment-id:96297947 --> @nabil-takla commented on GitHub (Apr 26, 2015): Dongri Jin recommended this: https://github.com/dongri/oauthswift.herokuapp.com. It works for me.
Author
Owner

@Sudhir007 commented on GitHub (Sep 14, 2015):

How to implement this https://github.com/dongri/oauthswift.herokuapp.com. in my project ?

<!-- gh-comment-id:139971848 --> @Sudhir007 commented on GitHub (Sep 14, 2015): How to implement this https://github.com/dongri/oauthswift.herokuapp.com. in my project ?
Author
Owner

@phimage commented on GitHub (Sep 29, 2015):

@nabil-takla please close this github issue if "it works for" you

<!-- gh-comment-id:144122677 --> @phimage commented on GitHub (Sep 29, 2015): @nabil-takla please close this github issue if "it works for" you
Author
Owner

@ofix-Parul commented on GitHub (Feb 9, 2024):

Thanks Gabriel for your quick reply. OAuth1Swift works but OAuth2Swift does not. The following is the code:

———————

func doOAuthLinkedin(){
    var error: NSError?
    let oauthswift = OAuth1Swift(
        consumerKey:    Linkedin["consumerKey"]!,
        consumerSecret: Linkedin["consumerSecret"]!,
        requestTokenUrl: "https://api.linkedin.com/uas/oauth/requestToken",
        authorizeUrl:    "https://api.linkedin.com/uas/oauth/authenticate",
        accessTokenUrl:  "https://api.linkedin.com/uas/oauth/accessToken"
    )
    oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, success: {
        credential, response in
        self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_token_secret:\(credential.oauth_token_secret)")
        var parameters =  Dictionary<String, AnyObject>()
        oauthswift.client.get("https://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),email-address,three-current-positions)", parameters: parameters,
            success: {
                data, response in
                let dataString = NSString(data: data, encoding: NSUTF8StringEncoding                    
                if let xmlDoc = AEXMLDocument(xmlData: data, error: &error) {

                    linkedinProfile[0] = xmlDoc.root["first-name"].value! + " " + xmlDoc.root["last-name"].value!
                    linkedinProfile[1] = xmlDoc.root["picture-urls"]["picture-url"].value!
                    linkedinProfile[2] = xmlDoc.root["three-current-positions"]["position"]["title"].value!
                    linkedinProfile[3] = xmlDoc.root["three-current-positions"]["position"]["company"]["name"].value!
                    linkedinProfile[4] = xmlDoc.root["email-address"].value!

// println(linkedinProfile) self.performSegueWithIdentifier("businessCard", sender: nil)

                } else {
                    println("description: \(error?.localizedDescription)\ninfo: \(error?.userInfo)")
                }

            }, failure: {(error:NSError!) -> Void in
                println(error)
        })
        }, failure: {(error:NSError!) -> Void in
            println(error.localizedDescription)
    })
}

//    func doOAuthLinkedin(){
//        let oauthswift = OAuth2Swift(
//            consumerKey:    Linkedin["consumerKey"]!,
//            consumerSecret: Linkedin["consumerSecret"]!,
//            authorizeUrl:   "https://www.linkedin.com/uas/oauth2/authorization",
//            responseType:   "token"
//        )
//        oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: {
//                        credential, response in
//                        self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)")
//                        var parameters =  Dictionary<String, AnyObject>()
//                        oauthswift.client.get("https://api.linkedin.com/v1/people/~", parameters: parameters,
//                            success: {
//                                data, response in
//                                let dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
//                                println(dataString)
//                            }, failure: {(error:NSError!) -> Void in
//                                println(error)
//                        })
//                        }, failure: {(error:NSError!) -> Void in
//                            println(error.localizedDescription)
//                    })
//    }

func showAlertView(title: String, message: String) {
    var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil))
    self.presentViewController(alert, animated: true, completion: nil)
}

——————————— OAuth2Swift is commented out. What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"?

Nabil

On Apr 12, 2015, at 9:23 AM, gabriel-jones notifications@github.com wrote:
As shown in the demo:
func doOAuthInstagram(){
let oauthswift = OAuth2Swift(
consumerKey: Instagram["consumerKey"]!,
consumerSecret: Instagram["consumerSecret"]!,
authorizeUrl: "https://api.instagram.com/oauth/authorize",
responseType: "token"
)

    oauthswift.webViewController = WebViewController()
    oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: {
        credential, response in
        self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)")
        let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)"
        let parameters :Dictionary = Dictionary<String, AnyObject>()
        oauthswift.client.get(url, 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)
    })
}```


Reply to this email directly or view it on GitHub #51 (comment).

@nabil-takla did you find the answer to this: "What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"?"

<!-- gh-comment-id:1936258860 --> @ofix-Parul commented on GitHub (Feb 9, 2024): > Thanks Gabriel for your quick reply. OAuth1Swift works but OAuth2Swift does not. The following is the code: > > ——————— > > ``` > func doOAuthLinkedin(){ > var error: NSError? > let oauthswift = OAuth1Swift( > consumerKey: Linkedin["consumerKey"]!, > consumerSecret: Linkedin["consumerSecret"]!, > requestTokenUrl: "https://api.linkedin.com/uas/oauth/requestToken", > authorizeUrl: "https://api.linkedin.com/uas/oauth/authenticate", > accessTokenUrl: "https://api.linkedin.com/uas/oauth/accessToken" > ) > oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, success: { > credential, response in > self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_token_secret:\(credential.oauth_token_secret)") > var parameters = Dictionary<String, AnyObject>() > oauthswift.client.get("https://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-urls::(original),email-address,three-current-positions)", parameters: parameters, > success: { > data, response in > let dataString = NSString(data: data, encoding: NSUTF8StringEncoding > if let xmlDoc = AEXMLDocument(xmlData: data, error: &error) { > > linkedinProfile[0] = xmlDoc.root["first-name"].value! + " " + xmlDoc.root["last-name"].value! > linkedinProfile[1] = xmlDoc.root["picture-urls"]["picture-url"].value! > linkedinProfile[2] = xmlDoc.root["three-current-positions"]["position"]["title"].value! > linkedinProfile[3] = xmlDoc.root["three-current-positions"]["position"]["company"]["name"].value! > linkedinProfile[4] = xmlDoc.root["email-address"].value! > ``` > > // println(linkedinProfile) self.performSegueWithIdentifier("businessCard", sender: nil) > > ``` > } else { > println("description: \(error?.localizedDescription)\ninfo: \(error?.userInfo)") > } > > }, failure: {(error:NSError!) -> Void in > println(error) > }) > }, failure: {(error:NSError!) -> Void in > println(error.localizedDescription) > }) > } > > // func doOAuthLinkedin(){ > // let oauthswift = OAuth2Swift( > // consumerKey: Linkedin["consumerKey"]!, > // consumerSecret: Linkedin["consumerSecret"]!, > // authorizeUrl: "https://www.linkedin.com/uas/oauth2/authorization", > // responseType: "token" > // ) > // oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/linkedin")!, scope: "r_fullprofile", state: "", success: { > // credential, response in > // self.showAlertView("Linkedin", message: "oauth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)") > // var parameters = Dictionary<String, AnyObject>() > // oauthswift.client.get("https://api.linkedin.com/v1/people/~", parameters: parameters, > // success: { > // data, response in > // let dataString = NSString(data: data, encoding: NSUTF8StringEncoding) > // println(dataString) > // }, failure: {(error:NSError!) -> Void in > // println(error) > // }) > // }, failure: {(error:NSError!) -> Void in > // println(error.localizedDescription) > // }) > // } > > func showAlertView(title: String, message: String) { > var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) > alert.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil)) > self.presentViewController(alert, animated: true, completion: nil) > } > ``` > > ——————————— OAuth2Swift is commented out. What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"? > > Nabil > > > On Apr 12, 2015, at 9:23 AM, gabriel-jones [notifications@github.com](mailto:notifications@github.com) wrote: > > As shown in the demo: > > func doOAuthInstagram(){ > > let oauthswift = OAuth2Swift( > > consumerKey: Instagram["consumerKey"]!, > > consumerSecret: Instagram["consumerSecret"]!, > > authorizeUrl: "https://api.instagram.com/oauth/authorize", > > responseType: "token" > > ) > > ``` > > oauthswift.webViewController = WebViewController() > > oauthswift.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/instagram")!, scope: "likes+comments", state:"INSTAGRAM", success: { > > credential, response in > > self.showAlertView("Instagram", message: "oauth_token:\(credential.oauth_token)") > > let url :String = "https://api.instagram.com/v1/users/1574083/?access_token=\(credential.oauth_token)" > > let parameters :Dictionary = Dictionary<String, AnyObject>() > > oauthswift.client.get(url, 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) > > }) > > }``` > > ``` > > > > > > > > > > > > > > > > > > > > > > > > — > > Reply to this email directly or view it on GitHub [#51 (comment)](https://github.com/OAuthSwift/OAuthSwift/issues/51#issuecomment-92085221). @nabil-takla did you find the answer to this: "What is the proper URL that I should supply in the Linkedin app web page for "OAuth 2.0 Redirect URLs"?"
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#33
No description provided.