[GH-ISSUE #282] Unable to Understand Header values. bellow is code i have used. Please suggest solution #166

Closed
opened 2026-03-03 16:46:19 +03:00 by kerem · 6 comments
Owner

Originally created by @Mahadev77 on GitHub (Sep 29, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/282

  oauthswift.client.request(
"api.tumblr.com/v2/blog/One_Touch_Share.tumblr.com/post", 
method: .POST, parameters: ["type":"text"], headers: ["Authorization":??????????????]
, success: {
                responce in
                print("Success..")
                },
 failure: { error in
            print("Failed.....")
            }
)
Originally created by @Mahadev77 on GitHub (Sep 29, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/282 ``` swift oauthswift.client.request( "api.tumblr.com/v2/blog/One_Touch_Share.tumblr.com/post", method: .POST, parameters: ["type":"text"], headers: ["Authorization":??????????????] , success: { responce in print("Success..") }, failure: { error in print("Failed.....") } ) ```
kerem 2026-03-03 16:46:19 +03:00
Author
Owner

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

  • please don't remove the bug template... and fill it
  • then use markdown for code
  • don't talk too mush into title, and say code bellow, talk into message...

I take my time to respond, take yours

headers: ["Authorization":??????????????] you don't have to fill header with "Authorization"
it is automatic if you are authentified
It's for additional headers that oauth provider need

<!-- gh-comment-id:250405345 --> @phimage commented on GitHub (Sep 29, 2016): - please don't remove the bug template... and fill it - then use markdown for code - don't talk too mush into title, and say code bellow, talk into message... I take my time to respond, take yours `headers: ["Authorization":??????????????]` you don't have to fill header with "Authorization" it is automatic if you are authentified It's for additional headers that oauth provider need
Author
Owner

@Mahadev77 commented on GitHub (Sep 29, 2016):

Dear,
you don't have to fill header with "Authorization"
it is automatic if you are authentified -- i am using

oauthswift.authorizeWithCallbackURL ( ) and then
oauthswift.client.request ( ) methods.
Now getting error "HTTP Status 404"
Please suggest solution,

Thanks for your reply.

On Thu, Sep 29, 2016 at 2:08 PM, Eric Marchand notifications@github.com
wrote:

please don't remove the template...

headers: ["Authorization":??????????????] you don't have to fill header
with "Authorization"
it is automatic if you are authentified
It's for additional headers that oauth provider need


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OAuthSwift/OAuthSwift/issues/282#issuecomment-250405345,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT3byTuDC3mC9xG3j4dts_j5dFzVHac_ks5qu3jpgaJpZM4KJqFS
.

<!-- gh-comment-id:250416538 --> @Mahadev77 commented on GitHub (Sep 29, 2016): Dear, you don't have to fill header with "Authorization" it is automatic if you are authentified -- i am using > > oauthswift.authorizeWithCallbackURL ( ) and then > > oauthswift.client.request ( ) methods. > > Now getting error "HTTP Status 404" > > Please suggest solution, Thanks for your reply. On Thu, Sep 29, 2016 at 2:08 PM, Eric Marchand notifications@github.com wrote: > please don't remove the template... > > headers: ["Authorization":??????????????] you don't have to fill header > with "Authorization" > it is automatic if you are authentified > It's for additional headers that oauth provider need > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > https://github.com/OAuthSwift/OAuthSwift/issues/282#issuecomment-250405345, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AT3byTuDC3mC9xG3j4dts_j5dFzVHac_ks5qu3jpgaJpZM4KJqFS > .
Author
Owner

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

I can help more without more information
404 is a generic http error, in web view or in log?

  • please add a breakpoint and see the full content of error if its an error in callback
  • your callback url is ?
<!-- gh-comment-id:250453038 --> @phimage commented on GitHub (Sep 29, 2016): I can help more without more information 404 is a generic http error, in web view or in log? - please add a breakpoint and see the full content of error if its an error in callback - your callback url is ?
Author
Owner

@Mahadev77 commented on GitHub (Sep 29, 2016):

Thank you for your reply.
I have sort out that problem.

Thanks,
Mahadev

On Thu, Sep 29, 2016 at 6:03 PM, Eric Marchand notifications@github.com
wrote:

I can help more without more information
404 is a generic http error, in web view or in log?

  • please add a breakpoint and see the full content of error if its an
    error in callback
  • your callback url is ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OAuthSwift/OAuthSwift/issues/282#issuecomment-250453038,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT3bya18IMdVaobYKviTYe8ZTM5qeAn2ks5qu7AfgaJpZM4KJqFS
.

<!-- gh-comment-id:250456817 --> @Mahadev77 commented on GitHub (Sep 29, 2016): Thank you for your reply. I have sort out that problem. Thanks, Mahadev On Thu, Sep 29, 2016 at 6:03 PM, Eric Marchand notifications@github.com wrote: > I can help more without more information > 404 is a generic http error, in web view or in log? > - please add a breakpoint and see the full content of error if its an > error in callback > - your callback url is ? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > https://github.com/OAuthSwift/OAuthSwift/issues/282#issuecomment-250453038, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AT3bya18IMdVaobYKviTYe8ZTM5qeAn2ks5qu7AfgaJpZM4KJqFS > .
Author
Owner

@idelfonsog2 commented on GitHub (Oct 18, 2016):

Hi @phimage Im having the same issues and I get this as a response:

Response-Body=Optional("{\"meta\":{\"status\":400,\"msg\":\"Bad Request\"},\"response\":{\"errors\":[\"Post cannot be empty.\"]}}")}]

my code is the following

 @IBAction func postTextBlog(_ sender: AnyObject) {
        print(oauth1swift?.parameters)

        let headers = ["Accept": "application/json", "Content-Type":"application/json"]

        let parameters = [ParameterKeys.BlogType:ParameterValues.MarkdownType, ParameterKeys.Body:textBlog.text] as [String : Any]

        oauth1swift?.client.request(TMClient.sharedInstance().tumblrURL(withPathExtension: Methods.PostText), method: .POST, parameters: parameters, headers: headers, success: {
            (data, error) in
            let json = TMClient.sharedInstance().convertToJSONObject(data: data)
            print(json)
            print("hello")

            }, failure: {
                error in
                print(error)
        })


    }

(TMClient.sharedInstance().tumblrURL(withPathExtension: Methods.PostText) is essentially this:
URL: https://api.tumblr.com/v2/blog/idelfonsog2.tumblr.com/post

you can also see it below

OAuthSwiftError.response=<NSHTTPURLResponse: 0x60000022dc80> { URL: https://api.tumblr.com/v2/blog/idelfonsog2.tumblr.com/post } { status code: 400, headers {
    Connection = "keep-alive";
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Tue, 18 Oct 2016 02:01:00 GMT";
    P3P = "CP=\"Tumblr's privacy policy is available here: https://www.tumblr.com/policy/en/privacy\"";
    Server = openresty;
    "Set-Cookie" = "tmgioct=5805825c60e2e80081398740; expires=Fri, 16-Oct-2026 02:01:00 GMT; Max-Age=315360000; path=/; domain=.tumblr.com; HttpOnly";
<!-- gh-comment-id:254387081 --> @idelfonsog2 commented on GitHub (Oct 18, 2016): Hi @phimage Im having the same issues and I get this as a response: `Response-Body=Optional("{\"meta\":{\"status\":400,\"msg\":\"Bad Request\"},\"response\":{\"errors\":[\"Post cannot be empty.\"]}}")}]` my code is the following ``` @IBAction func postTextBlog(_ sender: AnyObject) { print(oauth1swift?.parameters) let headers = ["Accept": "application/json", "Content-Type":"application/json"] let parameters = [ParameterKeys.BlogType:ParameterValues.MarkdownType, ParameterKeys.Body:textBlog.text] as [String : Any] oauth1swift?.client.request(TMClient.sharedInstance().tumblrURL(withPathExtension: Methods.PostText), method: .POST, parameters: parameters, headers: headers, success: { (data, error) in let json = TMClient.sharedInstance().convertToJSONObject(data: data) print(json) print("hello") }, failure: { error in print(error) }) } ``` (TMClient.sharedInstance().tumblrURL(withPathExtension: Methods.PostText) is essentially this: URL: https://api.tumblr.com/v2/blog/idelfonsog2.tumblr.com/post you can also see it below ``` OAuthSwiftError.response=<NSHTTPURLResponse: 0x60000022dc80> { URL: https://api.tumblr.com/v2/blog/idelfonsog2.tumblr.com/post } { status code: 400, headers { Connection = "keep-alive"; "Content-Type" = "application/json; charset=utf-8"; Date = "Tue, 18 Oct 2016 02:01:00 GMT"; P3P = "CP=\"Tumblr's privacy policy is available here: https://www.tumblr.com/policy/en/privacy\""; Server = openresty; "Set-Cookie" = "tmgioct=5805825c60e2e80081398740; expires=Fri, 16-Oct-2026 02:01:00 GMT; Max-Age=315360000; path=/; domain=.tumblr.com; HttpOnly"; ```
Author
Owner

@phimage commented on GitHub (Oct 18, 2016):

@idelfonsog2 please open a new issue
this one is closed and I see anything that can make us conclude easily that the issue is the same...

then I commit a tumblr test in demo app , a GET equest

a POST test will be added later (and it's work for me)

        let url = serviceParameters["blogURL"] ?? "good.tumblr.com"
        let _ = oauthswift.client.post(
            "https://api.tumblr.com/v2/user/follow", parameters: ["url": url],
            success: { data, response in
                print(String(data: data, encoding: .utf8))
            },
            failure: { error in
                print(error)
            }
        )
<!-- gh-comment-id:254473066 --> @phimage commented on GitHub (Oct 18, 2016): @idelfonsog2 please open a new issue this one is closed and I see anything that can make us conclude easily that the issue is the same... then I commit a tumblr test in demo app , a GET equest a POST test will be added later (and it's work for me) ``` swift let url = serviceParameters["blogURL"] ?? "good.tumblr.com" let _ = oauthswift.client.post( "https://api.tumblr.com/v2/user/follow", parameters: ["url": url], success: { data, response in print(String(data: data, encoding: .utf8)) }, failure: { error in print(error) } ) ```
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#166
No description provided.