---
title: "Manage Apple and Google Play accounts from the CLI"
description: "Connect Apple and Google Play accounts once, keep the credentials in Limrun secret storage, and manage store resources with the lim CLI."
sidebar:
  label: "Manage store accounts"
  order: 4
---

Connect your Apple or Google developer account once, then sign and publish builds with `lim` without key files. The CLI saves the credentials as secrets in your Limrun organization, and each build reads the one it needs from secret storage itself, so keys do not come back to the computer that starts the build.

The `auth` actions save credentials for later builds. Other actions manage store records, signing resources, and publishing. These commands manage developer accounts, not accounts inside a simulator or emulator.

## Before you start

Install the [Limrun CLI](/agents/setup) and use `lim login` or set `LIM_API_KEY`. Saving a credential needs secret write permission in your organization; builds that use it need secret read permission. Run Apple sign-in in an interactive terminal. Run Google sign-in on the same computer as your browser so the browser can return to the CLI's local callback.

Enter passwords and verification codes in the terminal or browser when prompted. Keep credentials out of chat and source control.

## Connect an Apple account

Use an Apple Account with administrator access to your Apple Developer team:

```bash
lim ios apple auth
```

Enter your Apple Account email, password, and verification code. If you belong to multiple teams, select the team to use. You can supply the account and team beforehand:

```bash
lim ios apple auth --account you@example.com --team-id YOUR_TEAM_ID
```

The command creates or reuses an App Store Connect API key. New keys have the `ADMIN` role for cloud signing and uploads. It saves the key as the secret `YOUR_TEAM_ID/APP_STORE_CONNECT_API_KEY` and never saves your Apple password. Apple serves the private key once, so it passes through this computer's memory when the key is created; it is not written to disk.

To sign and upload a device build with that key:

```bash
lim xcode build . --upload-to-appstore
```

Without signing flags, `--upload-to-appstore` uses Apple cloud signing with the `app-store-connect` method and a device SDK. The CLI looks up the key from secret metadata before it creates an instance, grants the instance read access to that one secret, and sends only the secret's name. The build reads the key from secret storage.

When you have saved keys for several teams, add `--team-id YOUR_TEAM_ID` to the build command, or name the secret with `--asc-key-secret`. Explicit `--asc-key` and `--asc-key-id` flags override the saved key. If you supply any ASC credential flag, supply the complete credentials for that key, including `--asc-issuer-id` for a team key. The CLI does not fill missing explicit credentials from the saved key.

Before uploading, create the App Store Connect record with `lim ios apple create-app` or in App Store Connect. See [Sign and distribute iOS builds](/ios/sign-and-distribute) for signing requirements and upload options.

## Connect a Google account

Sign in using the Google Desktop OAuth client bundled with the CLI:

```bash
lim android play auth
```

The CLI opens your browser. Sign in with a Google account that has publishing access to the target app in Play Console and grant the requested access. If the browser does not open, open the URL printed in the terminal on the same computer. Leave the command running until it reports that it saved the credentials.

To use your own OAuth client, pass `--client-config /path/to/client_secret.json`. It must be a **Desktop app** client from a Google Cloud project with the Google Play Android Developer API enabled and its consent screen configured. See Google's [Desktop OAuth setup](https://developers.google.com/identity/protocols/oauth2/native-app). Web clients and service-account JSON files cannot be used with `play auth`.

The CLI saves the OAuth client configuration and a refresh token as the secret `GOOGLE_PLAY_OAUTH`. Later builds read it from secret storage and refresh their access token themselves:

```bash
lim gradle build . --sign --upload-to-playstore
```

A new login replaces the saved one. Anyone who can read the secret can publish with your Google account, so keep it in an organization only you use, or save it under another name with `--secret-name` and limit who can read it. Use a saved login under another name, or a service account saved in the console, with `--playstore-secret NAME`. Explicit `--playstore-service-account` or `--playstore-access-token` credentials take precedence over the saved login, including an access token set through `LIM_PLAYSTORE_ACCESS_TOKEN`.

Before uploading, the app must exist in Play Console and its AAB must use the registered upload key. See [Sign and publish to Google Play](/android/sign-and-publish) for upload-key setup, tracks, and version codes.

## Manage Apple resources

Run `lim ios apple --help` to list the actions. Each action has its own flags:

```bash
lim ios apple list-bundle-ids --help
lim ios apple list-bundle-ids --team-id YOUR_TEAM_ID
lim ios apple create-bundle-id --team-id YOUR_TEAM_ID \
  --bundle-id com.example.app --name "Example app"
lim ios apple create-app --team-id YOUR_TEAM_ID \
  --bundle-id com.example.app --name "Example app"
```

Portal and App Store Connect actions prompt for a fresh Apple Account login and verification code. They use the selected team's session for that invocation, then close it. The saved App Store Connect key is for build signing and uploads; it cannot replace the portal session. Read-only actions do not create API keys. Your account needs permission for the action you request.

Use `--account` to supply the Apple Account email and `--team-id` to select the team. Actions that support both Developer Portal namespaces accept `--platform ios|mac`. This selects the portal namespace; it does not select a simulator. Resource results are JSON. An `--id` flag refers to Apple's opaque record ID returned by a list or create action, rather than the bundle identifier string.

| Resource | Actions after `lim ios apple` |
|---|---|
| Teams and agreements | `list-teams`, `list-pending-agreements` |
| Bundle IDs | `list-bundle-ids`, `create-bundle-id`, `get-bundle-id`, `rename-bundle-id`, `delete-bundle-id`, `update-app-service` |
| App Groups | `list-app-groups`, `create-app-group`, `ensure-app-group`, `delete-app-group`, `assign-app-groups` |
| iCloud containers | `list-cloud-containers`, `create-cloud-container`, `assign-cloud-containers` |
| Merchant IDs | `list-merchant-ids`, `create-merchant-id`, `delete-merchant-id`, `assign-merchant-ids` |
| Merchant domains | `list-merchant-domains`, `register-merchant-domain`, `download-merchant-domain-verification`, `verify-merchant-domain`, `delete-merchant-domain` |
| Wallet pass type IDs | `list-pass-type-ids`, `create-pass-type-id`, `delete-pass-type-id` |
| Website push IDs | `list-website-push-ids`, `create-website-push-id`, `delete-website-push-id` |
| Devices | `list-devices`, `register-device`, `enable-device`, `delete-device` |
| Certificates | `list-certificates`, `create-certificate`, `download-certificate`, `delete-certificate`, `ensure-certificate` |
| Provisioning profiles | `list-profiles`, `create-profile`, `get-profile`, `regenerate-profile`, `download-profile`, `delete-profile`, `save-profile`, `inspect-profile` |
| Developer service keys | `list-developer-keys`, `create-developer-key`, `get-developer-key`, `download-developer-key`, `revoke-developer-key` |
| App Store Connect API keys | `list-api-keys`, `create-api-key`, `download-api-key`, `ensure-api-key` |
| App Store Connect accounts and apps | `get-issuer-id`, `get-provider-id`, `list-vendor-numbers`, `find-app`, `create-app`, `ensure-app` |
| Local signing material | `generate-signing-key`, `export-certificate-p12` |

`ensure-app` and `ensure-app-group` reuse an existing matching resource or create it. `ensure-certificate` and `ensure-api-key` also save reusable signing credentials in secret storage, as `YOUR_TEAM_ID/<certificate type>` and `YOUR_TEAM_ID/APP_STORE_CONNECT_API_KEY`; `save-profile` downloads a profile and saves it as `YOUR_TEAM_ID/<profile UUID>`. These actions print the secret names, not the secret contents. To sign a build with a saved certificate and profiles, see [Sign with a certificate in secret storage](/ios/sign-and-distribute#sign-with-a-certificate-in-secret-storage).

### Change assignments and profiles

Assignment actions replace the complete set. Read `get-bundle-id` first and include any IDs you want to retain:

```bash
lim ios apple assign-app-groups --id APP_RECORD_ID \
  --resource-id EXISTING_GROUP_ID --resource-id NEW_GROUP_ID
```

Use `--clear` explicitly to remove every assignment. Assignments do not enable capabilities or regenerate profiles. Use `update-app-service` for a capability, then create or regenerate the affected profiles. For development and ad hoc profile regeneration, repeat `--device-id` for every device that must remain in the profile.

### Download keys and signing files

Downloads require `--output` and refuse to overwrite an existing file. Files have mode `0600` on Unix. Apple may allow a private-key download only once, so keep the file after a successful download:

```bash
lim ios apple download-developer-key --id KEY_ID --output notifications.p8
lim ios apple download-profile --id PROFILE_ID --output app.mobileprovision
```

Developer service keys and App Store Connect API keys are separate resources. Use `download-api-key` for the latter. `get-issuer-id` returns the selected team's App Store Connect issuer ID.

For manual signing, `generate-signing-key` writes a PKCS8 DER private key and a PEM CSR. Pass that CSR to `create-certificate`, download the resulting DER certificate, and combine it with the private key using `export-certificate-p12`. The export command reads the P12 password from `--password-file`. Run these local signing actions and `inspect-profile` without Apple login.

## Manage Google Play resources

Run `lim android play --help` for the command group or add `--help` to an action. Play API actions run on this computer, so they read the saved login from secret storage and refresh its access token on this computer. `--secret-name` selects a login saved under another name. `--access-token-file` can supply a token from another local tool and takes precedence over the saved login.

| Action after `lim android play` | Purpose |
|---|---|
| `auth` | Save a Google login in secret storage using a Desktop OAuth client. |
| `secrets` | List the saved Google logins, service accounts, and upload keys, and what is missing. |
| `refresh-auth` | Write a refreshed access token to a new private file for another local tool. |
| `enroll-signing` | Enroll the new app in Google's distribution signing service. |
| `generate-keystore` | Generate the app's upload key in secret storage, without replacing an existing key. |
| `export-keystore` | Export the saved PKCS12 keystore and a separate JSON file with its passwords and alias. |
| `publish` | Publish a signed AAB already in Limrun Asset Storage. |

To publish an existing asset:

```bash
lim android play publish --asset-name app-release.aab \
  --package-name com.example.app --track internal
```

Use either `--asset-name` or `--asset-id`. Publishing replaces the selected track's releases. For `--track production`, explicitly pass `--release-status draft` to save without rollout or `--release-status completed` to roll out.

### Enroll an existing Play app in signing

Signing enrollment uses an experimental, undocumented Google API. Google must approve the OAuth client for a Console scope, and the flow has not been verified end to end with an approved client. Ordinary `androidpublisher` access is insufficient. Once approved, sign in requesting the approved scope:

```bash
lim android play auth --client-config /path/to/client_secret.json \
  --console-scope https://www.googleapis.com/auth/play_console
```

Use `https://www.googleapis.com/auth/playdeveloperapp` instead if that is the scope Google approved. The CLI also requests `androidpublisher` so the saved login can publish.

Create the app in Play Console. Use its numeric developer account ID and app ID to enroll signing:

```bash
lim android play enroll-signing --developer-id 123456789 --app-id 987654321
```

Enrollment does not publish a release. If a request reports an unknown outcome, check Play Console before retrying.

### Generate an upload key ahead of the first build

```bash
lim android play generate-keystore --application-id com.example.app
lim android play export-keystore --application-id com.example.app \
  --output upload.p12 --credentials-output upload-credentials.json
```

Both commands use the secret `<application-id>/ANDROID_UPLOAD_KEY`, the same key `lim gradle build --sign` creates on its first build and signs with afterwards. Generation refuses to replace an existing key. Export writes the key to files, for example to enroll it in Play App Signing; both destinations must be new files. The credentials JSON contains `keystorePassword`, `keyAlias`, and `keyPassword`; keep it private with the keystore.

These actions do not register or reset Google's upload key. For an existing Play app, keep using its registered upload key: save it once with `lim gradle build --keystore ... --save-key`, as described in [Bring your own upload key](/android/sign-and-publish#bring-your-own-upload-key).

## Check saved credentials

List what is saved for each store, how builds use each credential, and what is still missing:

```bash
lim ios apple secrets --team-id YOUR_TEAM_ID --bundle-id com.example.app
lim android play secrets --application-id com.example.app
```

Both commands read secret metadata only. They never read a value or sign in to Apple or Google.

| Flag | Narrows |
|---|---|
| `--team-id` | Apple keys, certificates, and profiles to one team |
| `--bundle-id` | Apple provisioning profiles to those covering the bundle ID; keys and certificates serve every app |
| `--application-id` | Android upload keys to one app; Google logins serve every app |

Each row names the credential, what it is, its details and expiry, and how builds use it, for example `--certificate-secret YOUR_TEAM_ID/DISTRIBUTION`. Below the table, each missing credential comes with the command that saves it, such as `lim ios apple auth` when no App Store Connect key is saved. With `--json` the result is `{ "secrets": [...], "missing": [...] }`; an empty `missing` list means a release can run.

| Credential | Secret name | Read by |
|---|---|---|
| App Store Connect API key | `YOUR_TEAM_ID/APP_STORE_CONNECT_API_KEY` | Xcode builds that sign with cloud signing or upload to App Store Connect |
| Signing certificate | `YOUR_TEAM_ID/<certificate type>` | Xcode builds that pass `--certificate-secret` |
| Provisioning profile | `YOUR_TEAM_ID/<profile UUID>` | Xcode builds that pass `--provisioning-profile-secret` |
| Google login | `GOOGLE_PLAY_OAUTH`, or the `--secret-name` you chose | Gradle builds that publish, and `lim android play` actions on this computer |
| Android upload key | `<application-id>/ANDROID_UPLOAD_KEY` | Gradle builds with `--sign`, and `export-keystore` |

Limrun stores only descriptive metadata, such as a key ID, serial number, or bundle IDs. Values go directly between the client and Google Secret Manager, using a short-lived grant for one secret. `lim logout` removes your Limrun login only. To remove a saved store credential, delete its secret:

```bash
lim secret delete YOUR_TEAM_ID/APP_STORE_CONNECT_API_KEY
```

Deleting a secret does not revoke the credential. Revoke the API key in App Store Connect or remove the OAuth grant in your Google Account to invalidate it at the provider.

## Troubleshooting

| Problem | What to do |
|---|---|
| Apple sign-in requires an interactive terminal | Run `lim ios apple auth` directly in your terminal so you can enter the password and verification code. |
| Apple reports no Developer teams or the requested team is unavailable | Use an account with access to the intended Developer team and check `--team-id`. |
| The Google client configuration is rejected | Download a **Desktop app** OAuth client JSON file. A web client and a service-account key use different flows. |
| The Google browser callback cannot connect or sign-in times out | Run the command and browser on the same computer, then start sign-in again. |
| A saved Google login can no longer refresh | Run `lim android play auth` again, adding `--client-config` if you use your own client. |
| A build reports `Run lim ios apple auth first` or `Run lim android play auth first` | Run `lim ios apple secrets` or `lim android play secrets` to see what is saved, then run the command listed under missing. |
| Saving a credential fails with a permission error | Your API key or login needs secret write permission in the organization. |

To embed account connection in your own product, see [Publish to the stores](/platform/publish-to-stores).
