[GH-ISSUE #720] authorize with a request body #466

Closed
opened 2026-03-03 16:48:52 +03:00 by kerem · 2 comments
Owner

Originally created by @hrsma2i on GitHub (Jun 11, 2024).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/720

Description:

I have to add a parameter scope (particular to the OAuth1 API, not common one in the OAuth2 context) to the request body when getting a request token like:

# HTTPS
POST /oauth/initiate HTTP/1.1
Host: www.hatena.com
Authorization: OAuth realm="",
    oauth_callback="oob",
    oauth_consumer_key="yTVGWKqa6OiH5A%3D%3D",
    oauth_nonce="0c670efea71547422662",
    oauth_signature="lvQC7AXTRIaqxbjwVGgPlYuNaaw%3D",
    oauth_signature_method="HMAC-SHA1",
    oauth_timestamp="1291689730",oauth_version="1.0"
Content-Type: application/x-www-form-urlencoded
Content-Length: 33

scope=read_public%2Cread_private

OAuthSwiftClient.post has the body argument, but I don't know how to pass the body from authorize or postOAuthRequestToken. Is it not possible?

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

https://developer.hatena.ne.jp/ja/documents/auth/apis/oauth/consumer/#21-request-token-%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: v2.2.0

Xcode version:

  • 11.4 (Swift 5.2)

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • other: 15.3 (Swift 5.10)

  • objective c

Originally created by @hrsma2i on GitHub (Jun 11, 2024). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/720 ### Description: I have to add a parameter `scope` (particular to the OAuth1 API, not common one in the OAuth2 context) to the request body when getting a request token like: ``` # HTTPS POST /oauth/initiate HTTP/1.1 Host: www.hatena.com Authorization: OAuth realm="", oauth_callback="oob", oauth_consumer_key="yTVGWKqa6OiH5A%3D%3D", oauth_nonce="0c670efea71547422662", oauth_signature="lvQC7AXTRIaqxbjwVGgPlYuNaaw%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1291689730",oauth_version="1.0" Content-Type: application/x-www-form-urlencoded Content-Length: 33 scope=read_public%2Cread_private ``` OAuthSwiftClient.post has the `body` argument, but I don't know how to pass the body from `authorize` or `postOAuthRequestToken`. Is it not possible? ### OAuth Provider? (Twitter, Github, ..): https://developer.hatena.ne.jp/ja/documents/auth/apis/oauth/consumer/#21-request-token-%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B ### OAuth Version: - [x] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [ ] CocoaPods - [x] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ ] v2.1.0 - [ ] v2.0.0 - [ ] v1.4.1 - [x] other: v2.2.0 ### Xcode version: - [ ] 11.4 (Swift 5.2) - [ ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [x] other: 15.3 (Swift 5.10) - [ ] objective c
kerem closed this issue 2026-03-03 16:48:52 +03:00
Author
Owner

@phimage commented on GitHub (Jun 11, 2024):

maybe add it to one of your api url
../initiate?scope="xxx"
(by chance it will not be removed)

Le mar. 11 juin 2024 à 16:24, hiroshi.matsui @.***> a
écrit :

Description:

I have to add an original parameter scope to the request body when
getting a request token like:

HTTPS

POST /oauth/initiate HTTP/1.1
Host: www.hatena.com
Authorization: OAuth realm="",
oauth_callback="oob",
oauth_consumer_key="yTVGWKqa6OiH5A%3D%3D",
oauth_nonce="0c670efea71547422662",
oauth_signature="lvQC7AXTRIaqxbjwVGgPlYuNaaw%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1291689730",oauth_version="1.0"
Content-Type: application/x-www-form-urlencoded
Content-Length: 33

scope=read_public%2Cread_private

OAuthSwiftClient.post has the body argument, but I don't know how to pass
the body from authorize or postOAuthRequestToken. Is it not possible?
OAuth Provider? (Twitter, Github, ..):

https://developer.hatena.ne.jp/ja/documents/auth/apis/oauth/consumer/#21-request-token-%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B
OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: v2.2.0

Xcode version:

11.4 (Swift 5.2)

11.x (Swift 5.1)

10.x (Swift 5.0)

other: 15.3 (Swift 5.10)

objective c


Reply to this email directly, view it on GitHub
https://github.com/OAuthSwift/OAuthSwift/issues/720, or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACDW56E6DV2EKYA7I3XBPT3ZG4CBRAVCNFSM6AAAAABJEOVCFGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DMNJXGU2TONA
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

<!-- gh-comment-id:2160926669 --> @phimage commented on GitHub (Jun 11, 2024): maybe add it to one of your api url ../initiate?scope="xxx" (by chance it will not be removed) Le mar. 11 juin 2024 à 16:24, hiroshi.matsui ***@***.***> a écrit : > Description: > > I have to add an original parameter scope to the request body when > getting a request token like: > > # HTTPS > POST /oauth/initiate HTTP/1.1 > Host: www.hatena.com > Authorization: OAuth realm="", > oauth_callback="oob", > oauth_consumer_key="yTVGWKqa6OiH5A%3D%3D", > oauth_nonce="0c670efea71547422662", > oauth_signature="lvQC7AXTRIaqxbjwVGgPlYuNaaw%3D", > oauth_signature_method="HMAC-SHA1", > oauth_timestamp="1291689730",oauth_version="1.0" > Content-Type: application/x-www-form-urlencoded > Content-Length: 33 > > scope=read_public%2Cread_private > > OAuthSwiftClient.post has the body argument, but I don't know how to pass > the body from authorize or postOAuthRequestToken. Is it not possible? > OAuth Provider? (Twitter, Github, ..): > > > https://developer.hatena.ne.jp/ja/documents/auth/apis/oauth/consumer/#21-request-token-%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B > OAuth Version: > > - Version 1 > - Version 2 > > OS (Please fill the version) : > > - iOS : > - OSX : > - TVOS : > - WatchOS : > > Installation method: > > - Carthage > - CocoaPods > - Swift Package Manager > - Manually > > Library version: > > - head > - v2.1.0 > - v2.0.0 > - v1.4.1 > - other: v2.2.0 > > Xcode version: > > - > > 11.4 (Swift 5.2) > - > > 11.x (Swift 5.1) > - > > 10.x (Swift 5.0) > - > > other: 15.3 (Swift 5.10) > - > > objective c > > — > Reply to this email directly, view it on GitHub > <https://github.com/OAuthSwift/OAuthSwift/issues/720>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACDW56E6DV2EKYA7I3XBPT3ZG4CBRAVCNFSM6AAAAABJEOVCFGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DMNJXGU2TONA> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
Author
Owner

@hrsma2i commented on GitHub (Jun 11, 2024):

Thanks! I can do that.

<!-- gh-comment-id:2161056488 --> @hrsma2i commented on GitHub (Jun 11, 2024): Thanks! I can do that.
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#466
No description provided.