Skip to content

Commit 863f8c1

Browse files
committed
fix: align getUser with specs to throw, chore: spec indentation
1 parent 03b2d3b commit 863f8c1

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

sdks/implementations/swift/Sources/StackAuth/StackClientApp.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,30 +605,29 @@ public actor StackClientApp {
605605

606606
// Check if we should return this user
607607
if await user.isAnonymous && !includeAnonymous {
608-
return handleNoUser(or: or)
608+
return try handleNoUser(or: or)
609609
}
610610

611611
if await user.isRestricted && !effectiveIncludeRestricted {
612-
return handleNoUser(or: or)
612+
return try handleNoUser(or: or)
613613
}
614614

615615
return user
616616

617617
} catch {
618-
return handleNoUser(or: or)
618+
return try handleNoUser(or: or)
619619
}
620620
}
621621

622-
private func handleNoUser(or: GetUserOr) -> CurrentUser? {
622+
private func handleNoUser(or: GetUserOr) throws -> CurrentUser? {
623623
switch or {
624624
case .returnNull, .anonymous:
625625
return nil
626626
case .redirect:
627627
// Can't redirect in Swift
628628
return nil
629629
case .throw:
630-
// Already thrown
631-
return nil
630+
throw UserNotSignedInError()
632631
}
633632
}
634633

sdks/spec/src/_utilities.spec.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ All API requests follow this pattern. This section describes the complete reques
1010
### Base URL
1111

1212
Construct API URL: `{baseUrl}/api/v1{path}`
13-
- baseUrl defaults to "https://api.stack-auth.com"
13+
- baseUrl defaults to `https://api.stack-auth.com`
1414
- Remove trailing slash from final URL
1515
- Example: `https://api.stack-auth.com/api/v1/users/me`
1616

@@ -44,6 +44,7 @@ On 401 response with code="invalid_access_token":
4444
2. Fetch new access token using refresh token (see Token Refresh below)
4545
3. Retry the request with the new token
4646
4. If still 401 after retry: treat as unauthenticated
47+
4748
### [server-only] - Server Key Required
4849

4950
Include header: x-stack-secret-server-key: <secretServerKey>

sdks/spec/src/apps/client-app.spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Configuration requirements:
127127
- Note: The "Client ID" field in the dashboard is for web OAuth (Services ID), not native apps
128128

129129
Implementation notes:
130-
- The identityToken is a JWT that can be verified using Apple's JWKS (https://appleid.apple.com/auth/keys)
130+
- The identityToken is a JWT that can be verified using Apple's JWKS (`https://appleid.apple.com/auth/keys`)
131131
- The JWT's audience claim must match the configured Bundle ID
132132
- User's name and email are only provided on the FIRST authorization; cache if needed
133133
- The native flow does NOT use redirect URLs - tokens are returned directly

0 commit comments

Comments
 (0)