Skip to content
  • Sponsor
  • Notifications You must be signed in to change notification settings
  • Fork 135
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add example for third-party auth with Clerk #695

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -51,6 +51,8 @@
79BD76772B59C3E300CA3D68 /* UserStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD76762B59C3E300CA3D68 /* UserStore.swift */; };
79BD76792B59C53900CA3D68 /* ChannelStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD76782B59C53900CA3D68 /* ChannelStore.swift */; };
79BD767B2B59C61300CA3D68 /* MessageStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD767A2B59C61300CA3D68 /* MessageStore.swift */; };
79BE429E2D942E8100B9DDF4 /* ThirdPartyAuthClerk.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */; };
79BE42A12D942EFD00B9DDF4 /* Clerk in Frameworks */ = {isa = PBXBuildFile; productRef = 79BE42A02D942EFD00B9DDF4 /* Clerk */; };
79C9B8E52BBB16C0003AD942 /* SignInAnonymously.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79C9B8E42BBB16C0003AD942 /* SignInAnonymously.swift */; };
79D884CA2B3C18830009EA4A /* SlackCloneApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D884C92B3C18830009EA4A /* SlackCloneApp.swift */; };
79D884CC2B3C18830009EA4A /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D884CB2B3C18830009EA4A /* AppView.swift */; };
@@ -122,6 +124,7 @@
79BD76762B59C3E300CA3D68 /* UserStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserStore.swift; sourceTree = "<group>"; };
79BD76782B59C53900CA3D68 /* ChannelStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelStore.swift; sourceTree = "<group>"; };
79BD767A2B59C61300CA3D68 /* MessageStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageStore.swift; sourceTree = "<group>"; };
79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartyAuthClerk.swift; sourceTree = "<group>"; };
79C9B8E42BBB16C0003AD942 /* SignInAnonymously.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAnonymously.swift; sourceTree = "<group>"; };
79D884C72B3C18830009EA4A /* SlackClone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SlackClone.app; sourceTree = BUILT_PRODUCTS_DIR; };
79D884C92B3C18830009EA4A /* SlackCloneApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlackCloneApp.swift; sourceTree = "<group>"; };
@@ -155,6 +158,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
79BE42A12D942EFD00B9DDF4 /* Clerk in Frameworks */,
79E2B5582B97890F0042CD21 /* GoogleSignIn in Frameworks */,
795640702955B5190088A06F /* IdentifiedCollections in Frameworks */,
7956406D2955B3500088A06F /* SwiftUINavigation in Frameworks */,
@@ -208,6 +212,7 @@
793895C82954ABFF0044F2B8 /* Examples */ = {
isa = PBXGroup;
children = (
79BE429D2D942E7600B9DDF4 /* ThirdPartyAuthClerk.swift */,
79B1C80A2BABFF6F00D991AA /* Profile */,
797EFB642BABD7FF00098D6B /* Storage */,
79AF04822B2CE3BD008761AD /* Auth */,
@@ -370,6 +375,7 @@
7962989C2AEBC6F9000AA957 /* SVGView */,
79E2B5572B97890F0042CD21 /* GoogleSignIn */,
79E2B5592B97890F0042CD21 /* GoogleSignInSwift */,
79BE42A02D942EFD00B9DDF4 /* Clerk */,
);
productName = Examples;
productReference = 793895C62954ABFF0044F2B8 /* Examples.app */;
@@ -451,6 +457,7 @@
7956406E2955B5190088A06F /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
7962989B2AEBC6F9000AA957 /* XCRemoteSwiftPackageReference "SVGView" */,
79E2B5562B97890F0042CD21 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */,
);
productRefGroup = 793895C72954ABFF0044F2B8 /* Products */;
projectDirPath = "";
@@ -531,6 +538,7 @@
79C9B8E52BBB16C0003AD942 /* SignInAnonymously.swift in Sources */,
797EFB6A2BABDF3800098D6B /* BucketDetailView.swift in Sources */,
793E030D2B2DAB5700AC7DED /* SignInWithApple.swift in Sources */,
79BE429E2D942E8100B9DDF4 /* ThirdPartyAuthClerk.swift in Sources */,
793E030B2B2CEDDA00AC7DED /* ActionState.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -991,6 +999,14 @@
minimumVersion = 1.0.6;
};
};
79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/clerk/clerk-ios";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.52.0;
};
};
79E2B5562B97890F0042CD21 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/google/GoogleSignIn-iOS";
@@ -1026,6 +1042,11 @@
package = 7956406E2955B5190088A06F /* XCRemoteSwiftPackageReference "swift-identified-collections" */;
productName = IdentifiedCollections;
};
79BE42A02D942EFD00B9DDF4 /* Clerk */ = {
isa = XCSwiftPackageProductDependency;
package = 79BE429F2D942EFD00B9DDF4 /* XCRemoteSwiftPackageReference "clerk-ios" */;
productName = Clerk;
};
79D884D82B3C18E90009EA4A /* Supabase */ = {
isa = XCSwiftPackageProductDependency;
productName = Supabase;
24 changes: 24 additions & 0 deletions Examples/Examples/ThirdPartyAuthClerk.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// ThirdPartyAuthClerk.swift
// Examples
//
// Created by Guilherme Souza on 26/03/25.
//

import Clerk
import Foundation
import Supabase

extension SupabaseClient {
static let thirdPartyAuthWithClerk = SupabaseClient(
supabaseURL: URL(string: SupabaseConfig["SUPABASE_URL"]!)!,
supabaseKey: SupabaseConfig["SUPABASE_ANON_KEY"]!,
options: SupabaseClientOptions(
auth: SupabaseClientOptions.AuthOptions(
accessToken: {
try await Clerk.shared.session?.getToken()?.jwt
}
)
)
)
}
36 changes: 36 additions & 0 deletions Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -9,6 +9,33 @@
"version" : "1.7.6"
}
},
{
"identity" : "clerk-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/clerk/clerk-ios",
"state" : {
"revision" : "1ab675fa2551729016b5f222c8c161e0cff1b366",
"version" : "0.52.0"
}
},
{
"identity" : "factory",
"kind" : "remoteSourceControl",
"location" : "https://github.com/hmlongco/Factory",
"state" : {
"revision" : "fb04a8918848e413d3921d346a23bae7f81088d9",
"version" : "2.4.3"
}
},
{
"identity" : "get",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Get",
"state" : {
"revision" : "31249885da1052872e0ac91a2943f62567c0d96d",
"version" : "2.2.1"
}
},
{
"identity" : "googlesignin-ios",
"kind" : "remoteSourceControl",
@@ -45,6 +72,15 @@
"version" : "3.0.2"
}
},
{
"identity" : "simplekeychain",
"kind" : "remoteSourceControl",
"location" : "https://github.com/auth0/SimpleKeychain",
"state" : {
"revision" : "b694f155907b189bc82e93586695a26f558c742f",
"version" : "1.2.0"
}
},
{
"identity" : "svgview",
"kind" : "remoteSourceControl",
12 changes: 3 additions & 9 deletions Tests/HelpersTests/AsyncValueSubjectTests.swift
Original file line number Diff line number Diff line change
@@ -12,12 +12,6 @@ import XCTest

final class AsyncValueSubjectTests: XCTestCase {

override func invokeTest() {
withMainSerialExecutor {
super.invokeTest()
}
}

func testInitialValue() async {
let subject = AsyncValueSubject<Int>(42)
XCTAssertEqual(subject.value, 42)
@@ -45,7 +39,7 @@ final class AsyncValueSubjectTests: XCTestCase {
}
}

await Task.yield()
await Task.megaYield()

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

await Task.yield()
await Task.megaYield()

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

await Task.yield()
await Task.megaYield()

subject.yield(1)
subject.finish()
Loading