Skip to content

Commit 5c06db6

Browse files
authored
docs: add example for third-party auth with Clerk (#695)
1 parent b9dc3a3 commit 5c06db6

File tree

4 files changed

+84
-9
lines changed

4 files changed

+84
-9
lines changed

Diff for: Examples/Examples.xcodeproj/project.pbxproj

+21
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
79BD76772B59C3E300CA3D68 /* UserStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD76762B59C3E300CA3D68 /* UserStore.swift */; };
5252
79BD76792B59C53900CA3D68 /* ChannelStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD76782B59C53900CA3D68 /* ChannelStore.swift */; };
5353
79BD767B2B59C61300CA3D68 /* MessageStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD767A2B59C61300CA3D68 /* MessageStore.swift */; };
54+
79BE429E2D942E8100B9DDF4 /* ThirdPartyAuthClerk.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */; };
55+
79BE42A12D942EFD00B9DDF4 /* Clerk in Frameworks */ = {isa = PBXBuildFile; productRef = 79BE42A02D942EFD00B9DDF4 /* Clerk */; };
5456
79C9B8E52BBB16C0003AD942 /* SignInAnonymously.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79C9B8E42BBB16C0003AD942 /* SignInAnonymously.swift */; };
5557
79D884CA2B3C18830009EA4A /* SlackCloneApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D884C92B3C18830009EA4A /* SlackCloneApp.swift */; };
5658
79D884CC2B3C18830009EA4A /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D884CB2B3C18830009EA4A /* AppView.swift */; };
@@ -122,6 +124,7 @@
122124
79BD76762B59C3E300CA3D68 /* UserStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserStore.swift; sourceTree = "<group>"; };
123125
79BD76782B59C53900CA3D68 /* ChannelStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelStore.swift; sourceTree = "<group>"; };
124126
79BD767A2B59C61300CA3D68 /* MessageStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageStore.swift; sourceTree = "<group>"; };
127+
79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartyAuthClerk.swift; sourceTree = "<group>"; };
125128
79C9B8E42BBB16C0003AD942 /* SignInAnonymously.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAnonymously.swift; sourceTree = "<group>"; };
126129
79D884C72B3C18830009EA4A /* SlackClone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SlackClone.app; sourceTree = BUILT_PRODUCTS_DIR; };
127130
79D884C92B3C18830009EA4A /* SlackCloneApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlackCloneApp.swift; sourceTree = "<group>"; };
@@ -155,6 +158,7 @@
155158
isa = PBXFrameworksBuildPhase;
156159
buildActionMask = 2147483647;
157160
files = (
161+
79BE42A12D942EFD00B9DDF4 /* Clerk in Frameworks */,
158162
79E2B5582B97890F0042CD21 /* GoogleSignIn in Frameworks */,
159163
795640702955B5190088A06F /* IdentifiedCollections in Frameworks */,
160164
7956406D2955B3500088A06F /* SwiftUINavigation in Frameworks */,
@@ -208,6 +212,7 @@
208212
793895C82954ABFF0044F2B8 /* Examples */ = {
209213
isa = PBXGroup;
210214
children = (
215+
79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */,
211216
79B1C80A2BABFF6F00D991AA /* Profile */,
212217
797EFB642BABD7FF00098D6B /* Storage */,
213218
79AF04822B2CE3BD008761AD /* Auth */,
@@ -370,6 +375,7 @@
370375
7962989C2AEBC6F9000AA957 /* SVGView */,
371376
79E2B5572B97890F0042CD21 /* GoogleSignIn */,
372377
79E2B5592B97890F0042CD21 /* GoogleSignInSwift */,
378+
79BE42A02D942EFD00B9DDF4 /* Clerk */,
373379
);
374380
productName = Examples;
375381
productReference = 793895C62954ABFF0044F2B8 /* Examples.app */;
@@ -451,6 +457,7 @@
451457
7956406E2955B5190088A06F /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
452458
7962989B2AEBC6F9000AA957 /* XCRemoteSwiftPackageReference "SVGView" */,
453459
79E2B5562B97890F0042CD21 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
460+
79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */,
454461
);
455462
productRefGroup = 793895C72954ABFF0044F2B8 /* Products */;
456463
projectDirPath = "";
@@ -531,6 +538,7 @@
531538
79C9B8E52BBB16C0003AD942 /* SignInAnonymously.swift in Sources */,
532539
797EFB6A2BABDF3800098D6B /* BucketDetailView.swift in Sources */,
533540
793E030D2B2DAB5700AC7DED /* SignInWithApple.swift in Sources */,
541+
79BE429E2D942E8100B9DDF4 /* ThirdPartyAuthClerk.swift in Sources */,
534542
793E030B2B2CEDDA00AC7DED /* ActionState.swift in Sources */,
535543
);
536544
runOnlyForDeploymentPostprocessing = 0;
@@ -991,6 +999,14 @@
991999
minimumVersion = 1.0.6;
9921000
};
9931001
};
1002+
79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */ = {
1003+
isa = XCRemoteSwiftPackageReference;
1004+
repositoryURL = "https://github.com/clerk/clerk-ios";
1005+
requirement = {
1006+
kind = upToNextMajorVersion;
1007+
minimumVersion = 0.52.0;
1008+
};
1009+
};
9941010
79E2B5562B97890F0042CD21 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = {
9951011
isa = XCRemoteSwiftPackageReference;
9961012
repositoryURL = "https://github.com/google/GoogleSignIn-iOS";
@@ -1026,6 +1042,11 @@
10261042
package = 7956406E2955B5190088A06F /* XCRemoteSwiftPackageReference "swift-identified-collections" */;
10271043
productName = IdentifiedCollections;
10281044
};
1045+
79BE42A02D942EFD00B9DDF4 /* Clerk */ = {
1046+
isa = XCSwiftPackageProductDependency;
1047+
package = 79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */;
1048+
productName = Clerk;
1049+
};
10291050
79D884D82B3C18E90009EA4A /* Supabase */ = {
10301051
isa = XCSwiftPackageProductDependency;
10311052
productName = Supabase;

Diff for: Examples/Examples/ThirdPartyAuthClerk.swift

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// ThirdPartyAuthClerk.swift
3+
// Examples
4+
//
5+
// Created by Guilherme Souza on 26/03/25.
6+
//
7+
8+
import Clerk
9+
import Foundation
10+
import Supabase
11+
12+
extension SupabaseClient {
13+
static let thirdPartyAuthWithClerk = SupabaseClient(
14+
supabaseURL: URL(string: SupabaseConfig["SUPABASE_URL"]!)!,
15+
supabaseKey: SupabaseConfig["SUPABASE_ANON_KEY"]!,
16+
options: SupabaseClientOptions(
17+
auth: SupabaseClientOptions.AuthOptions(
18+
accessToken: {
19+
try await Clerk.shared.session?.getToken()?.jwt
20+
}
21+
)
22+
)
23+
)
24+
}

Diff for: Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved

+36
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@
99
"version" : "1.7.6"
1010
}
1111
},
12+
{
13+
"identity" : "clerk-ios",
14+
"kind" : "remoteSourceControl",
15+
"location" : "https://github.com/clerk/clerk-ios",
16+
"state" : {
17+
"revision" : "1ab675fa2551729016b5f222c8c161e0cff1b366",
18+
"version" : "0.52.0"
19+
}
20+
},
21+
{
22+
"identity" : "factory",
23+
"kind" : "remoteSourceControl",
24+
"location" : "https://github.com/hmlongco/Factory",
25+
"state" : {
26+
"revision" : "fb04a8918848e413d3921d346a23bae7f81088d9",
27+
"version" : "2.4.3"
28+
}
29+
},
30+
{
31+
"identity" : "get",
32+
"kind" : "remoteSourceControl",
33+
"location" : "https://github.com/kean/Get",
34+
"state" : {
35+
"revision" : "31249885da1052872e0ac91a2943f62567c0d96d",
36+
"version" : "2.2.1"
37+
}
38+
},
1239
{
1340
"identity" : "googlesignin-ios",
1441
"kind" : "remoteSourceControl",
@@ -45,6 +72,15 @@
4572
"version" : "3.0.2"
4673
}
4774
},
75+
{
76+
"identity" : "simplekeychain",
77+
"kind" : "remoteSourceControl",
78+
"location" : "https://github.com/auth0/SimpleKeychain",
79+
"state" : {
80+
"revision" : "b694f155907b189bc82e93586695a26f558c742f",
81+
"version" : "1.2.0"
82+
}
83+
},
4884
{
4985
"identity" : "svgview",
5086
"kind" : "remoteSourceControl",

Diff for: Tests/HelpersTests/AsyncValueSubjectTests.swift

+3-9
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ import XCTest
1212

1313
final class AsyncValueSubjectTests: XCTestCase {
1414

15-
override func invokeTest() {
16-
withMainSerialExecutor {
17-
super.invokeTest()
18-
}
19-
}
20-
2115
func testInitialValue() async {
2216
let subject = AsyncValueSubject<Int>(42)
2317
XCTAssertEqual(subject.value, 42)
@@ -45,7 +39,7 @@ final class AsyncValueSubjectTests: XCTestCase {
4539
}
4640
}
4741

48-
await Task.yield()
42+
await Task.megaYield()
4943

5044
subject.yield(1)
5145
subject.yield(2)
@@ -67,7 +61,7 @@ final class AsyncValueSubjectTests: XCTestCase {
6761
}
6862
}
6963

70-
await Task.yield()
64+
await Task.megaYield()
7165

7266
subject.yield(1)
7367
subject.yield(2)
@@ -89,7 +83,7 @@ final class AsyncValueSubjectTests: XCTestCase {
8983
}
9084
}
9185

92-
await Task.yield()
86+
await Task.megaYield()
9387

9488
subject.yield(1)
9589
subject.finish()

0 commit comments

Comments
 (0)