Skip to content
Open
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
22 changes: 3 additions & 19 deletions docs/platforms/android/build-distribution/auto-update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,7 @@ Make sure your Sentry Java version is at least 8.27.0 and you have the [Sentry A

You'll also need an [internal integration token](#create-an-integration-token) with Build Distribution permissions.

## Create an Integration Token

To use the Auto-Update SDK, you need to create an internal integration token with the appropriate permissions:

1. Navigate to **Settings > Custom Integrations** in your Sentry organization
2. Click **Create New Integration**
![Create New Integration =800x](./images/create-new-integration.png)

3. Select **Internal Integration** and click **Next**
![Internal Integration =600x](./images/internal-integration.png)

4. Give your integration a name (e.g., "Build Distribution")
![Name token =800x](./images/name-token.png)
5. Under **Permissions**, select **Read** next to the **Distribution** scope.
![Set Permissions =800x](./images/set-permissions.png)
6. Click **Save Changes**
7. Scroll down to the Tokens section and click **New Token**
![Create New Token =800x](./images/create-auth-token.png)
8. Copy the generated token to your CI secrets as an environment `SENTRY_DISTRIBUTION_AUTH_TOKEN`
<Include name="build-distribution/create-integration-token" />

## Installation

Expand Down Expand Up @@ -79,6 +61,8 @@ sentry {
}
```

This expect to find the environment variable `SENTRY_DISTRIBUTION_AUTH_TOKEN`, copy the token you generated in the preceding step to this variable in your CI environment.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This expect to find the environment variable `SENTRY_DISTRIBUTION_AUTH_TOKEN`, copy the token you generated in the preceding step to this variable in your CI environment.
This expects to find the environment variable `SENTRY_DISTRIBUTION_AUTH_TOKEN`, copy the token you generated in the preceding step to this variable in your CI environment.


### Configuration Options

| Option | Description | Default |
Expand Down
83 changes: 83 additions & 0 deletions docs/platforms/apple/guides/ios/build-distribution/auto-update.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: Auto-Update SDK
sidebar_title: Auto-Update SDK
sidebar_order: 10
description: Enable automatic update checks and installations for internal iOS builds using the Sentry Auto-Update SDK.
---

<Include name="feature-available-for-user-group-early-adopter" />

<Alert level="warning">

The Auto-Update SDK is designed for **internal builds only** and should never be used in production builds distributed through the App Store.

</Alert>

The Sentry Auto-Update SDK enables your internal iOS builds to automatically check for and install newer versions distributed through Sentry's Build Distribution. This is particularly useful for distributing nightly, alpha, or beta builds to your internal teams. It is not required to use the Sentry crash reporting SDK to use the iOS Auto-Update SDK.

## Pre-requisites

The SDK can only be installed using Swift Package Manager.

You'll also need an [internal integration token](#create-an-integration-token) with Build Distribution permissions.

<Include name="build-distribution/create-integration-token" />

## Installation

Add a dependency on the `SentryDistribution` target contained in the sentry-cocoa package (https://github.com/getsentry/sentry-cocoa)

```swift {filename:Package.swift}
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "{{@inject packages.version('sentry.cocoa') }}"),

.target(name: "MyTarget", dependencies: ["SentryDistribution"]),
```

## Usage

Use the SDK by calling `Updater.checkForUpdate(params: )`. In addition to the access token, provide your Sentry org and project slug in the CheckForUpdateParams. For example:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not very familiar with xcode but is there a way to provide a script to xcode that would create a file in the app that would automatically pass these things in?


```swift {filename:MyView.swift}
import SentryDistribution
import SwiftUI

struct MyView: View {
var body: some View {
Button("Check For Update") {
let params = CheckForUpdateParams(
accessToken: "MY_TOKEN",
organization: "___ORG_SLUG___",
project: "___PROJECT_SLUG___")
Updater.checkForUpdate(params: params) { result in
handleUpdateResult(result: result)
}
Comment on lines +46 to +53
Copy link
Member

Choose a reason for hiding this comment

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

Way better thanks

}
}

static func handleUpdateResult(result: Result<UpdateCheckResponse, Error>) {
guard case let .success(releaseInfo) = result else {
// Handle error
return
}

guard let releaseInfo = releaseInfo.update else {
print("Already up to date")
return
}

guard let url = Updater.buildUrlForInstall(releaseInfo.downloadUrl) else {
return
}
DispatchQueue.main.async {
Updater.install(url: url)
}
}
}
```

## Security Considerations

- **Internal Use Only**: Never ship the auto-update SDK in production builds destined for public app stores
- **Token Security**: The distribution token is embedded in the app and can be extracted by reverse engineering. Use tokens with only the distribution read permission which is the minimum required permission for the auto-update SDK.


19 changes: 19 additions & 0 deletions includes/build-distribution/create-integration-token.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Create an Integration Token

To use the Auto-Update SDK, you need to create an internal integration token with the appropriate permissions:

1. Navigate to **Settings > Custom Integrations** in your Sentry organization
1. Click **Create New Integration**
![Create New Integration =800x](./images/create-new-integration.png)

1. Select **Internal Integration** and click **Next**
![Internal Integration =600x](./images/internal-integration.png)

1. Give your integration a name (e.g., "Build Distribution")
![Name token =800x](./images/name-token.png)
1. Under **Permissions**, select **Read** next to the **Distribution** scope.
![Set Permissions =800x](./images/set-permissions.png)
1. Click **Save Changes**
1. Scroll down to the Tokens section and click **New Token**
![Create New Token =800x](./images/create-auth-token.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation

1. Save the generated token, you'll need it to integrate the SDK
Loading