Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9e3edcb
Set OAuthSwift pod version to 2.1.3
vgritsenko Aug 14, 2020
e903aeb
add consumer secret conditionally to parameters
Nov 13, 2020
10973f2
make change consistent with existing code
Nov 13, 2020
7d5ba2c
clear current access token before renewing
Nov 13, 2020
881c0ba
fix indentation
Nov 14, 2020
41dfc1d
Pass error description along with server error messages
ChrisJAWerner Dec 14, 2020
6dfbb74
Add reddit service to OAuthSwift demo
Jan 2, 2021
2384f60
Merge pull request #641 from nnbrandon/reddit
phimage Jan 6, 2021
4ec7559
[Fix] repairs conditional compilation for platforms that are currentl…
macbellingrath Jan 19, 2021
6faed68
Added code verifier & code challenge generator for working with PKCE
MrWoWander Mar 2, 2021
1d7e828
Update ReadMe
MrWoWander Mar 2, 2021
a7cc1c7
Linux limitation
MrWoWander Mar 2, 2021
05d8f1a
fix readme
MrWoWander Mar 2, 2021
3436c73
🚨 Fix new warning in Xcode 12.5
phatblat Apr 29, 2021
038911d
🙈 Ignore .build, .swiftpm
phatblat Apr 29, 2021
4f31eab
👷Do not try to install SwiftLint if already installed
phimage Apr 29, 2021
1a50678
👷Use default Xcode path in github action build
phimage Apr 29, 2021
009620e
🧹Fix swiftlint warnings about spaces
phimage Apr 29, 2021
787877e
Update travis osx_image
phimage Apr 29, 2021
cbcd78a
👷 Update mac version on travis
phimage Apr 29, 2021
24157aa
test import crypto
MrWoWander Apr 29, 2021
9370d37
added swift-crypto package for Linux
MrWoWander Apr 29, 2021
a1f3748
Update test package dependencies
phimage Apr 29, 2021
6372c18
👷Add xcodebuild in github action
e-marchand Apr 29, 2021
ab08d91
👷test on macOS instead
phimage Apr 29, 2021
b25d719
added support Crypto
MrWoWander Apr 29, 2021
de3f930
Merge branch 'pkce_test' into pkce
MrWoWander Apr 29, 2021
36a90e4
Fix readme
MrWoWander Apr 29, 2021
efda1f3
Merge pull request #647 from MrWoWander/pkce
phimage Apr 29, 2021
ef2815d
swiftlint: use `identifier_name` instead of deprecated `variable_name`
phimage Apr 29, 2021
3e98e46
👷test using xcodebuild
phimage Apr 29, 2021
e09698d
Allow to add consumer key to oauth1 authorise url fix #644
phimage Apr 29, 2021
4969686
🐛 Add colon after scheme in error redirect URL
phatblat May 3, 2021
56b8ef5
Merge branch 'master' into bug/fix-podspec
phatblat May 5, 2021
dcc1f67
Merge pull request #654 from phatblat/error-redirect
phimage May 5, 2021
dd92279
Merge pull request #633 from paullalonde/issue-625-fix
phimage May 5, 2021
c351c8f
optionally change authorize url param names
daironmichel May 13, 2021
a986697
Merge pull request #643 from macbellingrath/bug/fix-podspec
phatblat May 13, 2021
7e88151
Merge pull request #655 from daironmichel/master
phimage May 13, 2021
74c1ac5
Merge pull request #620 from vgritsenko/cocoapods-version-2.0.3
phatblat May 17, 2021
51b8570
🐛 Encode oauth_signature parameters
phatblat May 18, 2021
2a41a37
🚨 Fix trailing whitespace
phatblat May 18, 2021
dbb74fa
Merge pull request #657 from OAuthSwift/encode-signature
phimage May 18, 2021
b84d267
Build for catalyst and ios in two step
phimage May 18, 2021
c6bf2c8
Fix compilation on macCatalyst by excluding usage of `SFAuthenticatio…
phimage May 18, 2021
2fc57d0
🚨 Fix whitespace
phatblat May 19, 2021
89e821a
Merge pull request #658 from OAuthSwift/fix/macCatalyst
phimage May 19, 2021
4e6e7c7
🔖 Version 2.2.0
phatblat May 18, 2021
d1ac4ec
🚨 Fix markdown lint warnings, update version on readme
phatblat May 18, 2021
037cd16
👌🏻 Restore pairs of links on readme
phatblat May 19, 2021
ea6505a
⏱ Set test action timeout to 60m
phatblat May 20, 2021
d85964b
Merge pull request #659 from OAuthSwift/release-2.2.0
phatblat May 20, 2021
d2dc4cd
Fix unowned self
MarkJerde Jul 16, 2021
d34eed0
Updated a few expired links in README
DhruvSaraswat Aug 5, 2021
910e5bb
Open external URL from main thread
diogomusou Aug 17, 2021
8e62dc0
Update OAuthSwift.swift
phimage Sep 2, 2021
7c9e311
Merge pull request #682 from MarkJerde/fix_unowned_self
phimage Dec 3, 2021
af202d4
Merge pull request #673 from diogomusou/master
phimage Dec 3, 2021
f8462b3
Customize request headers and custom path response
Jan 26, 2022
bd3166f
Add Withings OAuth2 for testing
Jan 26, 2022
6f78efd
Merge branch 'feature/Dynamic-Keypath' into develop
Jan 26, 2022
fb65e91
Merge pull request #691 from HootCode/develop
phimage Jan 28, 2022
a6551ec
Remove usage of SFAuthenticationErrorDomain to avoid getting app reje…
raxityo Jun 7, 2022
73f9787
Merge pull request #699 from raxityo/rax/fix/remove-SFAuthenticationE…
phatblat Jun 7, 2022
11453e3
Remove showing network activity
cmittendorf Apr 29, 2022
d10de2e
Merge pull request #697 from cmittendorf/networkactivity-main-thread
phimage Nov 10, 2022
a04f7b7
Merge pull request #670 from DhruvSaraswat/master
phimage Nov 10, 2022
6329128
Added parsing of id_token, if present in access token response
colinhumber Oct 7, 2021
2dcf238
Added Codable and NSCoder support to include idToken
colinhumber Oct 8, 2021
fe6b6a4
Add VisionOS Support
phnagy Apr 16, 2024
0b53e92
Merge remote-tracking branch 'upstream/master' into more-error-messag…
adambard Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@ on: push
jobs:
build:
name: build
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_11.1.app/Contents/Developer
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
- name: libxml
run: brew install libxml2
- name: Swift build
- name: Swift build macOS
run: |
swift build
- name: Xcode build macOS
run: |
xcodebuild -scheme "OAuthSwiftMacOS" | xcpretty -c; exit ${PIPESTATUS[0]}
- name: Swift build iOS
run: |
sdk=`xcrun -sdk iphonesimulator -show-sdk-path`
sdkVersion=`echo $sdk | sed -E 's/.*iPhoneSimulator(.*)\.sdk/\1/'`
swift build -Xswiftc "-sdk" -Xswiftc "$sdk" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios$sdkVersion-simulator"
- name: Xcode build iOS
run: |
xcodebuild -scheme "OAuthSwift" -sdk iphonesimulator | xcpretty -c; exit ${PIPESTATUS[0]}
- name: Xcode build mac Catalyst
run: |
xcodebuild -scheme "OAuthSwift" | xcpretty -c; exit ${PIPESTATUS[0]}
8 changes: 6 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ on: push
jobs:
lint:
name: Lint
runs-on: macOS-latest
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Install swiftlint
run: |
brew install swiftlint
if [ -z "$(which swiftlint)" ]; then
brew install swiftlint
else
swiftlint version
fi
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Code Lint
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ on: push
jobs:
build:
name: test
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_11.1.app/Contents/Developer
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@master
Expand All @@ -15,6 +14,14 @@ jobs:
run: brew install libxml2
- name: Swift test
run: |
sdk=`xcrun -sdk iphonesimulator -show-sdk-path`
sdkVersion=`echo $sdk | sed -E 's/.*iPhoneSimulator(.*)\.sdk/\1/'`
swift test -Xswiftc "-sdk" -Xswiftc "$sdk" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios$sdkVersion-simulator"
# on mac os
swift --version
swift test
# on iOS (deactivate until resolve issue with XCText)
#sdk=`xcrun -sdk iphonesimulator -show-sdk-path`
#sdkVersion=`echo $sdk | sed -E 's/.*iPhoneSimulator(.*)\.sdk/\1/'`
#swift test -Xswiftc "-sdk" -Xswiftc "$sdk" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios$sdkVersion-simulator"
- name: Xcode test
run: |
pod update
xcodebuild -workspace OAuthSwift.xcworkspace -scheme OAuthSwiftMacOS test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ Podfile.lock

# Carthage
Carthage/

# SwiftPM
.build/
.swiftpm/
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ included:
disabled_rules:
- file_length
- cyclomatic_complexity
- variable_name
- identifier_name
- todo
- line_length
- type_body_length
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: objective-c
osx_image: xcode11.1
osx_image: xcode12.2
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- PROJECT=OAuthSwift.xcodeproj
- IOS_FRAMEWORK_SCHEME="OAuthSwift"
- MACOS_FRAMEWORK_SCHEME="OAuthSwiftMacOS"
- IOS_SDK=iphonesimulator13.1
- MACOS_SDK=macosx10.15
- IOS_SDK=iphonesimulator14.2
- MACOS_SDK=macosx11.0
matrix:
- DESTINATION="OS=13.1,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
- DESTINATION="OS=14.2,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
- DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK"
before_install:
- bundle install
Expand Down
14 changes: 14 additions & 0 deletions Demo/Common/Services.plist
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
<key>consumerSecret</key>
<string></string>
</dict>
<key>Withings2</key>
<dict>
<key>consumerKey</key>
<string></string>
<key>consumerSecret</key>
<string></string>
</dict>
<key>Linkedin</key>
<dict>
<key>consumerKey</key>
Expand Down Expand Up @@ -247,5 +254,12 @@
<key>consumerKey</key>
<string></string>
</dict>
<key>Reddit</key>
<dict>
<key>consumerKey</key>
<string></string>
<key>consumerSecret</key>
<string></string>
</dict>
</dict>
</plist>
87 changes: 87 additions & 0 deletions Demo/Common/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ extension ViewController {
doOAuthFitbit2(parameters)
case "Withings":
doOAuthWithings(parameters)
case "Withings2":
doOAuthWithings2(parameters)
case "Linkedin":
doOAuthLinkedin(parameters)
case "Linkedin2":
Expand Down Expand Up @@ -174,6 +176,8 @@ extension ViewController {
doOAuthLyft(parameters)
case "Twitch":
doOAuthTwitch(parameters)
case "Reddit":
doOauthReddit(parameters)
default:
print("\(service) not implemented")
}
Expand Down Expand Up @@ -541,6 +545,47 @@ extension ViewController {
}
}
}
func doOAuthWithings2(_ serviceParameters: [String:String]){
let oauthswift = OAuth2Swift(
consumerKey: serviceParameters["consumerKey"]!,
consumerSecret: serviceParameters["consumerSecret"]!,
authorizeUrl: "https://account.withings.com/oauth2_user/authorize2",
accessTokenUrl: "https://wbsapi.withings.net/v2/oauth2",
responseType: "code",
customKeypath: "body",
customAccessTokenParams: ["action":"requesttoken"]
)

self.oauthswift = oauthswift
oauthswift.authorizeURLHandler = getURLHandler()
let _ = oauthswift.authorize(
withCallbackURL: URL(string: "oauth-swift://oauth-callback/withings")!,
scope: "user.metrics,user.activity,user.sleepevents",
state: "TEST") { result in
switch result {
case .success(let (credential, _, parameters)):
self.showTokenAlert(name: serviceParameters["name"], credential: credential)
self.testWithings2(oauthswift, userId: parameters["userid"] as! String)
case .failure(let error):
print(error.description)
}
}
}
func testWithings2(_ oauthswift: OAuth2Swift, userId : String) {
oauthswift.client.paramsLocation = .requestURIQuery
let _ = oauthswift.client.get(
"https://wbsapi.withings.net/v2/measure",
parameters: ["action": "getactivity", "userid": userId, "date":"2022-01-01"]) { result in
switch result {
case .success(let response):
let jsonDict = try? response.jsonObject()
print(jsonDict as Any)
case .failure(let error):
print(error.description)
}
}
}


// MARK: Linkedin
func doOAuthLinkedin(_ serviceParameters: [String:String]){
Expand Down Expand Up @@ -1390,6 +1435,48 @@ extension ViewController {
}
}
}

func doOauthReddit(_ serviceParameters: [String:String]) {
let oauthswift = OAuth2Swift(
consumerKey: serviceParameters["consumerKey"]!,
consumerSecret: serviceParameters["consumerSecret"]!,
authorizeUrl: "https://www.reddit.com/api/v1/authorize.compact",
accessTokenUrl: "https://www.reddit.com/api/v1/access_token",
responseType: "code",
contentType: "application/json"
)
self.oauthswift = oauthswift
oauthswift.accessTokenBasicAuthentification = true
oauthswift.authorizeURLHandler = getURLHandler()
let state = generateState(withLength: 20)
let _ = oauthswift.authorize(
withCallbackURL: URL(string: "oauth-swift://oauth-callback/reddit")!, scope: "read", state: state) { result in
switch result {
case .success(let (credential, _, _)):
self.showTokenAlert(name: serviceParameters["name"], credential: credential)
self.testReddit(oauthswift, credential.oauthToken)
case .failure(let error):
print(error.description)
}
}
}

func testReddit(_ oauthswift: OAuth2Swift, _ oauthToken: String) {
let applicationName = "" // Provided by developer
let username = "" // Provided by developer
let userAgent = "ios:\(applicationName):1.0 (by /u/\(username)"
let headers = ["Authorization": "Bearer \(oauthToken)", "User-Agent": userAgent]
let _ = oauthswift.client.get(
"https://oauth.reddit.com/r/all", headers: headers) { result in
switch result {
case .success(let response):
let dataString = response.string!
print(dataString)
case .failure(let error):
print(error)
}
}
}
}

let services = Services()
Expand Down
5 changes: 4 additions & 1 deletion OAuthSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OAuthSwift'
s.version = '2.1.0'
s.version = '2.2.0'
s.license = 'MIT'
s.summary = 'Swift based OAuth library for iOS and macOS.'
s.homepage = 'https://github.com/OAuthSwift/OAuthSwift'
Expand All @@ -9,6 +9,9 @@ Pod::Spec.new do |s|
'Dongri Jin' => 'dongrify@gmail.com',
'Eric Marchand' => 'eric.marchand.n7@gmail.com'
}
s.weak_frameworks = 'AuthenticationServices'
s.ios.frameworks = 'SafariServices'
s.osx.frameworks = 'SafariServices'
s.source = { git: 'https://github.com/OAuthSwift/OAuthSwift.git', tag: s.version }
s.source_files = 'Sources/**/*.swift'
s.swift_versions = ['5.0', '5.1']
Expand Down
Loading