[GH-ISSUE #43] Callback URL #27

Closed
opened 2026-03-03 16:44:54 +03:00 by kerem · 2 comments
Owner

Originally created by @Berdikhan on GitHub (Apr 7, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/43

Hi everyone
When I set the callback URL to my own application it gives error
Error Domain=NSURLErrorDomain Code=400 "HTTP Status 400: Bad Request, Response: oauth_problem=parameter_rejected&message=oauth_callback" UserInfo=0x7c8b4e80
But when I set the callback url to my website it works.
And another issue is that I cannot handle the access token and access token secret, I can only see it in a url attached such as "http://website.com?access_token=sdjflkdjsf&access_token_secret=asdasdasd"

func Authenthication(){
        let client = OAuth1Swift(
            consumerKey: "consumerkey",
            consumerSecret: "consumersecret",
            requestTokenUrl: "http://192.168.54.35/ergasia/oauth/initiate",
            authorizeUrl: "http://192.168.54.35/ergasia/oauth/authorize",
            accessTokenUrl: "http://192.168.54.35/ergasia/oauth/token")
        client.webViewController = WebViewController()
        client.authorizeWithCallbackURL(NSURL(string: "nettium://")!, success: { credential, response in
            println("\(credential.oauth_token)")
            self.credent = credential
        }) { (error) -> Void in
            println(error)
        }
    }

If I do in this way everything works, except it does not show an alertView and cannot get an access token

        client.authorizeWithCallbackURL(NSURL(string: "http://192.168.54.35/ergasia/customer/account")!, success: { credential, response in
            self.showAlertView("Magento", message: "auth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)")
            println("\(credential.oauth_token)")
        }) { (error) -> Void in
            println(error)
        }

Any ideas? Need help, thanks

Originally created by @Berdikhan on GitHub (Apr 7, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/43 Hi everyone When I set the callback URL to my own application it gives error Error Domain=NSURLErrorDomain Code=400 "HTTP Status 400: Bad Request, Response: oauth_problem=parameter_rejected&message=oauth_callback" UserInfo=0x7c8b4e80 But when I set the callback url to my website it works. And another issue is that I cannot handle the access token and access token secret, I can only see it in a url attached such as "http://website.com?access_token=sdjflkdjsf&access_token_secret=asdasdasd" ``` func Authenthication(){ let client = OAuth1Swift( consumerKey: "consumerkey", consumerSecret: "consumersecret", requestTokenUrl: "http://192.168.54.35/ergasia/oauth/initiate", authorizeUrl: "http://192.168.54.35/ergasia/oauth/authorize", accessTokenUrl: "http://192.168.54.35/ergasia/oauth/token") client.webViewController = WebViewController() client.authorizeWithCallbackURL(NSURL(string: "nettium://")!, success: { credential, response in println("\(credential.oauth_token)") self.credent = credential }) { (error) -> Void in println(error) } } ``` If I do in this way everything works, except it does not show an alertView and cannot get an access token ``` client.authorizeWithCallbackURL(NSURL(string: "http://192.168.54.35/ergasia/customer/account")!, success: { credential, response in self.showAlertView("Magento", message: "auth_token:\(credential.oauth_token)\n\noauth_toke_secret:\(credential.oauth_token_secret)") println("\(credential.oauth_token)") }) { (error) -> Void in println(error) } ``` Any ideas? Need help, thanks
kerem closed this issue 2026-03-03 16:44:55 +03:00
Author
Owner

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

The callback url should be oauth-swift://oauth-callback/application_name -- does this not work?

<!-- gh-comment-id:92135274 --> @gabriel-jones commented on GitHub (Apr 12, 2015): The callback url should be `oauth-swift://oauth-callback/application_name` -- does this not work?
Author
Owner

@Berdikhan commented on GitHub (Apr 13, 2015):

Nope, I set the same URL as previous, just handled it from WebViewController. I saved tokens to NSUserDefaults. And created clients using saved tokens. Now it works fine

<!-- gh-comment-id:92225581 --> @Berdikhan commented on GitHub (Apr 13, 2015): Nope, I set the same URL as previous, just handled it from WebViewController. I saved tokens to NSUserDefaults. And created clients using saved tokens. Now it works fine
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#27
No description provided.