Skip to content

Commit ca0a878

Browse files
committed
fix: Remove clientId from authentication data
1 parent 5e3ae16 commit ca0a878

File tree

4 files changed

+0
-26
lines changed

4 files changed

+0
-26
lines changed

Sources/ParseSwift/Authentication/3rd Party/ParseSpotify/ParseSpotify+async.swift

-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public extension ParseSpotify {
1616
Login a `ParseUser` *asynchronously* using Spotify authentication.
1717
- parameter id: The **Spotify profile id** from **Spotify**.
1818
- parameter accessToken: Required **access_token** from **Spotify**.
19-
- parameter clientId: Optional **client_id** from **Spotify**.
2019
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
2120
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
2221
- parameter options: A set of header options sent to the server. Defaults to an empty set.
@@ -25,14 +24,12 @@ public extension ParseSpotify {
2524
*/
2625
func login(id: String,
2726
accessToken: String,
28-
clientId: String? = nil,
2927
expiresIn: Int? = nil,
3028
refreshToken: String? = nil,
3129
options: API.Options = []) async throws -> AuthenticatedUser {
3230
try await withCheckedThrowingContinuation { continuation in
3331
self.login(id: id,
3432
accessToken: accessToken,
35-
clientId: clientId,
3633
expiresIn: expiresIn,
3734
refreshToken: refreshToken,
3835
options: options,
@@ -62,7 +59,6 @@ public extension ParseSpotify {
6259
Link the *current* `ParseUser` *asynchronously* using Spotify authentication.
6360
- parameter id: The **Spotify profile id** from **Spotify**.
6461
- parameter accessToken: Required **access_token** from **Spotify**.
65-
- parameter clientId: Optional **client_id** from **Spotify**.
6662
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
6763
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
6864
- parameter options: A set of header options sent to the server. Defaults to an empty set.
@@ -71,14 +67,12 @@ public extension ParseSpotify {
7167
*/
7268
func link(id: String,
7369
accessToken: String,
74-
clientId: String? = nil,
7570
expiresIn: Int? = nil,
7671
refreshToken: String? = nil,
7772
options: API.Options = []) async throws -> AuthenticatedUser {
7873
try await withCheckedThrowingContinuation { continuation in
7974
self.link(id: id,
8075
accessToken: accessToken,
81-
clientId: clientId,
8276
expiresIn: expiresIn,
8377
refreshToken: refreshToken,
8478
options: options,

Sources/ParseSwift/Authentication/3rd Party/ParseSpotify/ParseSpotify+combine.swift

-6
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@ public extension ParseSpotify {
1616
Login a `ParseUser` *asynchronously* using Spotify authentication. Publishes when complete.
1717
- parameter id: The **Spotify profile id** from **Spotify**.
1818
- parameter accessToken: Required **access_token** from **Spotify**.
19-
- parameter clientId: Optional **client_id** from **Spotify**.
2019
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
2120
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
2221
- parameter options: A set of header options sent to the server. Defaults to an empty set.
2322
- returns: A publisher that eventually produces a single value and then finishes or fails.
2423
*/
2524
func loginPublisher(id: String,
2625
accessToken: String,
27-
clientId: String? = nil,
2826
expiresIn: Int? = nil,
2927
refreshToken: String? = nil,
3028
options: API.Options = []) -> Future<AuthenticatedUser, ParseError> {
3129
Future { promise in
3230
self.login(id: id,
3331
accessToken: accessToken,
34-
clientId: clientId,
3532
expiresIn: expiresIn,
3633
refreshToken: refreshToken,
3734
options: options,
@@ -60,22 +57,19 @@ public extension ParseSpotify {
6057
Publishes when complete.
6158
- parameter id: The **Spotify profile id** from **Spotify**.
6259
- parameter accessToken: Required **access_token** from **Spotify**.
63-
- parameter clientId: Optional **client_id** from **Spotify**.
6460
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
6561
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
6662
- parameter options: A set of header options sent to the server. Defaults to an empty set.
6763
- returns: A publisher that eventually produces a single value and then finishes or fails.
6864
*/
6965
func linkPublisher(id: String,
7066
accessToken: String,
71-
clientId: String? = nil,
7267
expiresIn: Int? = nil,
7368
refreshToken: String? = nil,
7469
options: API.Options = []) -> Future<AuthenticatedUser, ParseError> {
7570
Future { promise in
7671
self.link(id: id,
7772
accessToken: accessToken,
78-
clientId: clientId,
7973
expiresIn: expiresIn,
8074
refreshToken: refreshToken,
8175
options: options,

Sources/ParseSwift/Authentication/3rd Party/ParseSpotify/ParseSpotify.swift

-12
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,23 @@ public struct ParseSpotify<AuthenticatedUser: ParseUser>: ParseAuthentication {
2121
enum AuthenticationKeys: String, Codable {
2222
case id
2323
case accessToken = "access_token"
24-
case clientId = "client_id"
2524
case expirationDate = "expiration_date"
2625
case refreshToken = "refresh_token"
2726
/// Properly makes an authData dictionary with the required keys.
2827
/// - parameter id: Required id for the user.
2928
/// - parameter accessToken: Required access token for Spotify.
30-
/// - parameter clientId: Optional client id for Spotify.
3129
/// - parameter expiresIn: Optional expiration in seconds for Spotify.
3230
/// - parameter refreshToken: Optional refresh token for Spotify.
3331
/// - returns: authData dictionary.
3432
func makeDictionary(id: String,
3533
accessToken: String,
36-
clientId: String? = nil,
3734
expiresIn: Int? = nil,
3835
refreshToken: String? = nil) -> [String: String] {
3936

4037
var returnDictionary = [
4138
AuthenticationKeys.id.rawValue: id,
4239
AuthenticationKeys.accessToken.rawValue: accessToken
4340
]
44-
if let clientId = clientId {
45-
returnDictionary[AuthenticationKeys.clientId.rawValue] = clientId
46-
}
4741
if let expiresIn = expiresIn,
4842
let expirationDate = Calendar.current.date(byAdding: .second,
4943
value: expiresIn,
@@ -83,7 +77,6 @@ public extension ParseSpotify {
8377
Login a `ParseUser` *asynchronously* using Spotify authentication.
8478
- parameter id: The **Spotify profile id** from **Spotify**.
8579
- parameter accessToken: Required **access_token** from **Spotify**.
86-
- parameter clientId: Optional **client_id** from **Spotify**.
8780
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
8881
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
8982
- parameter options: A set of header options sent to the server. Defaults to an empty set.
@@ -92,7 +85,6 @@ public extension ParseSpotify {
9285
*/
9386
func login(id: String,
9487
accessToken: String,
95-
clientId: String? = nil,
9688
expiresIn: Int? = nil,
9789
refreshToken: String? = nil,
9890
options: API.Options = [],
@@ -102,7 +94,6 @@ public extension ParseSpotify {
10294
let spotifyAuthData = AuthenticationKeys.id
10395
.makeDictionary(id: id,
10496
accessToken: accessToken,
105-
clientId: clientId,
10697
expiresIn: expiresIn,
10798
refreshToken: refreshToken)
10899
login(authData: spotifyAuthData,
@@ -137,7 +128,6 @@ public extension ParseSpotify {
137128
Link the *current* `ParseUser` *asynchronously* using Spotify authentication.
138129
- parameter id: The **Spotify profile id** from **Spotify**.
139130
- parameter accessToken: Required **access_token** from **Spotify**.
140-
- parameter clientId: Optional **client_id** from **Spotify**.
141131
- parameter expiresIn: Optional **expires_in** in seconds from **Spotify**.
142132
- parameter refreshToken: Optional **refresh_token** from **Spotify**.
143133
- parameter options: A set of header options sent to the server. Defaults to an empty set.
@@ -146,7 +136,6 @@ public extension ParseSpotify {
146136
*/
147137
func link(id: String,
148138
accessToken: String,
149-
clientId: String? = nil,
150139
expiresIn: Int? = nil,
151140
refreshToken: String? = nil,
152141
options: API.Options = [],
@@ -155,7 +144,6 @@ public extension ParseSpotify {
155144
let spotifyAuthData = AuthenticationKeys.id
156145
.makeDictionary(id: id,
157146
accessToken: accessToken,
158-
clientId: clientId,
159147
expiresIn: expiresIn,
160148
refreshToken: refreshToken)
161149
link(authData: spotifyAuthData,

Tests/ParseSwiftTests/ParseSpotifyTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class ParseSpotifyTests: XCTestCase {
108108
let authData = ParseSpotify<User>
109109
.AuthenticationKeys.id.makeDictionary(id: "testing",
110110
accessToken: "access_token",
111-
clientId: "client_id",
112111
expiresIn: 10,
113112
refreshToken: "refresh_token")
114113
guard let dateString = authData["expiration_date"] else {
@@ -117,7 +116,6 @@ class ParseSpotifyTests: XCTestCase {
117116
}
118117
XCTAssertEqual(authData, ["id": "testing",
119118
"access_token": "access_token",
120-
"client_id": "client_id",
121119
"expiration_date": dateString,
122120
"refresh_token": "refresh_token"])
123121
}

0 commit comments

Comments
 (0)