[GH-ISSUE #536] Failing to upload an mp4 video using postMultiPartRequest #353

Closed
opened 2026-03-03 16:47:59 +03:00 by kerem · 2 comments
Owner

Originally created by @MickeDG on GitHub (Jul 25, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/536

Description: I'm trying to upload an mp4 video file but it's failing with the following error:

Response-Body={"message":"Missing OAuth1 parameters (oauth_consumer_key, oauth_timestamp, oauth_nonce, oauth_signature, oauth_signature_method, oauth_token, oauth_version)","code":"oauth-gateway","data":{"status":502}

My code:

let urlStringUp = "https://xxxx/recorded-videos"    
fileToUploadUrl = fileManager.urlForDocumentsDirectoryFile(fileName: fileName) 
let videoData = try Data(contentsOf: fileToUploadUrl)
let fileData = OAuthSwiftMultipartData(name: "file", data: videoData, fileName: fileName, mimeType: nil)
let multiparts = [fileData]
let binary = "binary".data(using: OAuthSwiftDataEncoding)!
let parameters: OAuthSwift.Parameters = [ "media": binary]
oauthSwift.client.postMultiPartRequest(urlStringUp, method: .POST, parameters: parameters , multiparts: multiparts)

OAuth Provider? (Twitter, Github, ..):

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • [x ] CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.0.0
  • v1.4.1
  • v1.2.1
  • v1.2 (Swift 4.0)
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • 10.x (Swift 4.1)

  • 9.3 (Swift 4.1)

  • 9.0 (Swift 4.0)

  • other: (Please fill in the version you are using.)

  • objective c

Originally created by @MickeDG on GitHub (Jul 25, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/536 ### Description: I'm trying to upload an mp4 video file but it's failing with the following error: Response-Body={"message":"Missing OAuth1 parameters (oauth_consumer_key, oauth_timestamp, oauth_nonce, oauth_signature, oauth_signature_method, oauth_token, oauth_version)","code":"oauth-gateway","data":{"status":502} My code: ```swift let urlStringUp = "https://xxxx/recorded-videos" fileToUploadUrl = fileManager.urlForDocumentsDirectoryFile(fileName: fileName) let videoData = try Data(contentsOf: fileToUploadUrl) let fileData = OAuthSwiftMultipartData(name: "file", data: videoData, fileName: fileName, mimeType: nil) let multiparts = [fileData] let binary = "binary".data(using: OAuthSwiftDataEncoding)! let parameters: OAuthSwift.Parameters = [ "media": binary] oauthSwift.client.postMultiPartRequest(urlStringUp, method: .POST, parameters: parameters , multiparts: multiparts) ``` ### OAuth Provider? (Twitter, Github, ..): ### OAuth Version: - [x] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x ] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [x] v2.0.0 - [ ] v1.4.1 - [ ] v1.2.1 - [ ] v1.2 (Swift 4.0) - [ ] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [ ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [x] 10.x (Swift 4.1) - [ ] 9.3 (Swift 4.1) - [ ] 9.0 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:47:59 +03:00
Author
Owner

@phimage commented on GitHub (Jul 26, 2019):

you do not respond to the important question, the provider
you put xxx, is it a private server?

<!-- gh-comment-id:515540262 --> @phimage commented on GitHub (Jul 26, 2019): you do not respond to the important question, the provider you put xxx, is it a private server?
Author
Owner

@MickeDG commented on GitHub (Jul 29, 2019):

Well - it's a company server. The url is: "https://upload.onlinetennisinstruction.com/wp-json/oti-api/1.0/users/current/recorded-videos"

<!-- gh-comment-id:515892249 --> @MickeDG commented on GitHub (Jul 29, 2019): Well - it's a company server. The url is: "https://upload.onlinetennisinstruction.com/wp-json/oti-api/1.0/users/current/recorded-videos"
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#353
No description provided.