Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions Sources/ClerkKit/Core/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ public struct Auth {

/// Signs in with a ticket generated from the Backend API.
///
/// If the ticket is scoped to an organization, the resulting session activates that
/// organization. After sign-in succeeds, access the organization ID through
/// ``Clerk/session`` and ``Session/lastActiveOrganizationId``.
///
/// - Parameter ticket: The ticket string from the Backend API.
/// - Returns: A `SignIn` object representing the sign-in attempt.
/// - Throws: An error if the ticket sign-in fails.
Expand Down
1 change: 1 addition & 0 deletions Tests/Domains/Auth/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ struct AuthTests {
_ = try await Clerk.shared.auth.signInWithTicket("mock_ticket_value")

let params = try #require(signInParams.value)
#expect(params.strategy == .ticket)
#expect(params.ticket == "mock_ticket_value")
}

Expand Down
9 changes: 6 additions & 3 deletions Tests/Middleware/ClerkClientSyncResponseMiddlewareTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct ClerkClientSyncResponseMiddlewareTests {
}

@Test
func validateAppliesClientFromClientResponseEnvelope() async throws {
func validateAppliesOrganizationScopedTicketSessionFromClientResponseEnvelope() async throws {
configureClerkForTesting()
let clerk = Clerk()
let middleware = ClerkClientSyncResponseMiddleware(runtimeScope: .current(clerkProvider: { clerk }))
Expand All @@ -76,8 +76,11 @@ struct ClerkClientSyncResponseMiddlewareTests {
var expectedClient = Client.mock
expectedClient.lastActiveSessionId = session.id
expectedClient.sessions = [session]
let data = try JSONEncoder.clerkEncoder.encode(ClientResponse<Session>(response: session, client: expectedClient))
let url = try #require(URL(string: "https://example.com/v1/client/sessions/\(session.id)/touch"))
var signIn = SignIn.mock
signIn.status = .complete
signIn.createdSessionId = session.id
let data = try JSONEncoder.clerkEncoder.encode(ClientResponse<SignIn>(response: signIn, client: expectedClient))
let url = try #require(URL(string: "https://example.com/v1/client/sign_ins"))
let response = try #require(HTTPURLResponse(
url: url,
statusCode: 200,
Expand Down