Skip to content

docs: Document Swift SDK (Preview)#1131

Closed
promptless[bot] wants to merge 1 commit intodevfrom
promptless/document-swift-sdk-preview
Closed

docs: Document Swift SDK (Preview)#1131
promptless[bot] wants to merge 1 commit intodevfrom
promptless/document-swift-sdk-preview

Conversation

@promptless
Copy link
Contributor

@promptless promptless bot commented Jan 23, 2026

Open this suggestion in Promptless to view citations and reasoning process

Adds documentation for the new Swift SDK that provides native authentication for iOS, macOS, watchOS, tvOS, and visionOS applications. Creates a comprehensive getting started guide covering installation via Swift Package Manager, sign-up/sign-in flows, token storage options (Keychain, memory, explicit), error handling, OAuth authentication with the stack-auth:// callback scheme, and server-side usage. Updates the setup page to list Swift as a supported platform. The documentation is marked as "Preview" since the SDK publishes to a prerelease repository.

Updated for PR #1130: OAuth documentation now reflects the new API requiring explicit redirectUrl and errorRedirectUrl parameters for manual OAuth flows, documents the fixed stack-auth:// callback scheme used by signInWithOAuth(), and notes that custom schemes require backend configuration.

Trigger Events

stack-auth/stack-auth PR #1117: SDK specs

Promptless Research (1 GitHub PR)

Agent Response

I've completed documenting the new Swift SDK from PR #1117. Here's a summary of what I created:

Documentation Changes

New File: Swift SDK Getting Started Guide (docs/content/docs/(guides)/getting-started/swift.mdx)

  • Marked as "Preview" with a warning callout since the SDK publishes to a prerelease repository
  • Covers installation via Swift Package Manager (both Package.swift and Xcode UI)
  • Quick start examples for sign-up, sign-in, OAuth, and sign-out
  • Token storage options: Keychain (default), memory, and explicit tokens
  • Error handling patterns using Swift's native throws mechanism
  • OAuth authentication using ASWebAuthenticationSession
  • Server-side usage with StackServerApp
  • Comparison table showing key differences from the JavaScript SDK
  • Links to REST API docs, Discord for feedback, and example apps

Updated: Setup Page (docs/content/docs/(guides)/getting-started/setup.mdx)

  • Added Swift as a supported platform in the prerequisites list
  • Linked to the new Swift SDK documentation

The suggestion is ready for your review. I marked the SDK as "Preview" since it's being published to stack-auth/swift-sdk-prerelease rather than a stable release repository, which allows early adopters to start using it while setting appropriate expectations about API stability.

stack-auth/stack-auth PR #1130: [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work

Promptless Research (1 GitHub PR)

Agent Response

I've completed the documentation updates for PR #1130. Here's a summary of what I did:

Summary

I updated the existing "Document Swift SDK (Preview)" suggestion to reflect the OAuth API changes introduced in this PR.

Changes Made

1. Updated OAuth code examples (docs/code-examples/swift.ts):

  • Added comments about the fixed stack-auth:// callback scheme for signInWithOAuth()
  • Updated getOAuthUrl() to show the new required parameters (redirectUrl, errorRedirectUrl)
  • Updated callOAuthCallback() to include the required redirectUrl parameter

2. Updated Swift SDK documentation (docs/content/docs/(guides)/getting-started/swift.mdx):

  • Reorganized the OAuth section into clear subsections:
    • Simple OAuth (Recommended) - for signInWithOAuth() which handles everything automatically
    • Manual OAuth Flow - for getOAuthUrl() + callOAuthCallback() when more control is needed
  • Documented that the stack-auth:// scheme works out of the box
  • Added a note that custom schemes (like myapp://) require configuration as a trusted domain

Why I Updated the Existing Suggestion

Since PR #1130 modifies the Swift SDK OAuth functionality that was already being documented in the existing suggestion, I updated that suggestion rather than creating a new one. This keeps all Swift SDK documentation changes together for easier review.

The suggestion is available for review at: https://app.gopromptless.ai/change-history/e3d2d5a3-8ff4-421c-bbc2-1cb6b5f9de84


Help us improve Promptless — If this suggestion missed the mark, please share quick feedback.

If you want Promptless to make further changes on this PR, feel free to leave a comment tagging Promptless (It won't show up in the user drop down but Promptless will get it!)

@@ -0,0 +1,131 @@
---
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Based on the Swift SDK implementation in sdks/implementations/swift/ and the SDK README (sdks/implementations/swift/README.md) which documents installation, quick start, token storage options, error handling, OAuth flows, and server-side usage patterns. Marked as preview since it publishes to stack-auth/swift-sdk-prerelease.
View source


### Simple OAuth (Recommended)

For most apps, simply use `signInWithOAuth()` — it handles the entire OAuth flow automatically. It uses the `stack-auth://` callback scheme, which works without any additional configuration:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: OAuth API changes from PR #1130: signInWithOAuth() now uses fixed stack-auth:// callback scheme, getOAuthUrl() requires explicit redirectUrl and errorRedirectUrl parameters, and callOAuthCallback() requires the redirectUrl parameter. See changes in sdks/spec/src/apps/client-app.spec.md for the spec and sdks/implementations/swift/Sources/StackAuth/StackClientApp.swift for the implementation.
View source

@vercel
Copy link

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
stack-backend Ready Ready Preview, Comment Jan 23, 2026 10:28pm
stack-dashboard Ready Ready Preview, Comment Jan 23, 2026 10:28pm
stack-demo Ready Ready Preview, Comment Jan 23, 2026 10:28pm
stack-docs Ready Ready Preview, Comment Jan 23, 2026 10:28pm


'oauth': [
{
language: 'Swift',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Updated OAuth code examples based on PR #1130. The new API signatures are documented in sdks/implementations/swift/README.md and the spec at sdks/spec/src/apps/client-app.spec.md.
View source

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@promptless
Copy link
Contributor Author

promptless bot commented Jan 23, 2026

🔧 I noticed that some CI checks failed for this PR. I'm investigating the failures and will work on fixing them.

1 similar comment
@promptless
Copy link
Contributor Author

promptless bot commented Jan 23, 2026

🔧 I noticed that some CI checks failed for this PR. I'm investigating the failures and will work on fixing them.

@promptless promptless bot marked this pull request as ready for review January 28, 2026 02:17
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR adds comprehensive documentation for the new Swift SDK (Preview), enabling native authentication for iOS, macOS, watchOS, tvOS, and visionOS applications.

  • Created complete Swift SDK getting started guide with installation, authentication flows, OAuth handling, token storage options, and error handling patterns
  • Added Swift code examples for all SDK features including credential-based auth, OAuth, token storage strategies, and server-side operations
  • Updated setup page to list Swift as a supported platform with appropriate prerequisites
  • Documented both simple OAuth flow (using signInWithOAuth() with fixed stack-auth:// callback) and manual OAuth flow (using getOAuthUrl() + callOAuthCallback() with explicit redirect URLs)
  • Properly marked SDK as "Preview" with warning callout since it publishes to prerelease repository
  • Included security warnings about never using secret server keys in client-side code

The documentation is well-structured, follows existing patterns from other SDK docs, and accurately reflects the OAuth API changes from PR #1130.

Confidence Score: 5/5

  • This PR is safe to merge - it adds documentation only with no code changes
  • Documentation-only PR with well-structured content following existing patterns, appropriate security warnings included, and proper preview labeling for prerelease SDK
  • No files require special attention

Important Files Changed

Filename Overview
docs/code-examples/swift.ts Created comprehensive Swift code examples covering all SDK features
docs/content/docs/(guides)/getting-started/swift.mdx Created comprehensive Swift SDK documentation with installation, auth flows, and best practices

Sequence Diagram

sequenceDiagram
    participant App as Swift App
    participant SDK as StackClientApp
    participant Browser as ASWebAuthenticationSession
    participant OAuth as OAuth Provider
    participant Backend as Stack Auth Backend

    Note over App,Backend: Simple OAuth Flow (signInWithOAuth)
    App->>SDK: signInWithOAuth(provider: "google")
    SDK->>Backend: getOAuthUrl(provider, redirectUrl: "stack-auth://")
    Backend-->>SDK: {url, state, codeVerifier}
    SDK->>Browser: Open OAuth URL
    Browser->>OAuth: User authenticates
    OAuth->>Browser: Redirect to stack-auth://
    Browser-->>SDK: Callback with code
    SDK->>Backend: callOAuthCallback(url, codeVerifier, redirectUrl)
    Backend-->>SDK: {accessToken, refreshToken}
    SDK->>SDK: Store tokens in Keychain
    SDK-->>App: Success

    Note over App,Backend: Manual OAuth Flow
    App->>SDK: getOAuthUrl(provider, redirectUrl, errorRedirectUrl)
    SDK->>Backend: Request OAuth URL
    Backend-->>SDK: {url, state, codeVerifier, redirectUrl}
    SDK-->>App: OAuth details
    App->>App: Store state & codeVerifier
    App->>Browser: Open oauth.url manually
    Browser->>OAuth: User authenticates
    OAuth->>Browser: Redirect to custom URL
    Browser-->>App: Callback URL
    App->>SDK: callOAuthCallback(url, codeVerifier, redirectUrl)
    SDK->>Backend: Exchange code for tokens
    Backend-->>SDK: {accessToken, refreshToken}
    SDK->>SDK: Store tokens
    SDK-->>App: Success
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@madster456 madster456 closed this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants