How scopes work#
- Declare every scope your app may use in the manifest's
scopes. Ask for as few as possible. - Approval: the SALOPHA team reviews and approves each one. Undeclared or unapproved scopes answer
scope_denied. - Consent: some scopes show the user a sheet once, some every time, some never (the operating system may still ask). Ask lazily with
requestScope(scope)right before the feature that needs it, and handlegranted: falsegracefully. - Revocation: users can revoke any scope in Settings › Mini apps. See When consent is revoked.
import { MiniAppScopes } from "@salopha/mini-app-sdk";
const r = await app.requestScope(MiniAppScopes.addressesRead); // { scope, granted, oneTime?, alreadyGranted? }
if (r.granted) showAddresses(await app.getAddresses());
Reference#
| Scope | The user sees | Gives your app |
|---|---|---|
profile.basic | A sheet once | Name, photo, language: getIdentity() and the server profile |
profile.phone | A sheet once | The verified phone: getPhoneNumber() and the server profile |
profile.phone.request | Every time | The phone for this use only |
location.current | A sheet once | getLocation(), the page's navigator.geolocation in a phone web view |
location.precise | Every time | getLocation({ precise: true }) |
addresses.read | A sheet once | All saved addresses: getAddresses(), server me/addresses. Not needed for pickAddress(). |
transactions.read | A sheet once | The user's transactions with your app: getTransactions(), server me/transactions |
camera.pick | Every time | pickImage({ source: "camera" }) |
media.pick | A sheet once | pickImage({ source: "gallery" }) |
file.pick | A sheet once | pickFile() (a plain <input type=file> works without the bridge) |
contacts.pick | Every time | pickContact() |
qr.scan | A sheet once | scanQr() |
notifications.service | A sheet once | Your server may notify the user; requestNotifications() asks |
share.object | A sheet once | shareObject(), sendToChat() and chat actions |
chat.open | A sheet once | openChat() |
business.profile.read | A sheet once | openBusiness() and business profiles |
biometric.auth | No sheet | authenticateBiometric() |
clipboard.write | No sheet | copyText() |
share.system | No sheet | shareText() |
maps.open | No sheet | openMaps() |
phone.call | No sheet | callPhone() |
url.open | No sheet | openUrl() |
storage.local | No sheet | storage.get/set/remove/clear |
shortcut.create | No sheet | createShortcut() (also needs runtime.allowShortcut) |
transaction.publish.server | Never (server only) | Publishing transaction events from your server |
business.binding.manage | Never (server only) | Connecting your merchants to SALOPHA businesses |
"No sheet" scopes still have to be declared and approved; the device may show its own prompt (for example biometrics). Server-only scopes can never be requested from the page: the SDK refuses them with method_not_allowed.
Choosing the user's address#
pickAddress() needs no scope: the user picks one saved address (or adds one), and that choice is the consent. Use it for any delivery or visit address. Ask for addresses.read only when you really need the whole list.
Privacy rules SALOPHA enforces#
- The profile photo is shared only when the user shows it to everyone.
- An automatic grant of
profile.phoneincludes the number only when the user shows it to everyone; otherwise your app must ask, and the user's explicit consent always wins. - Never cache personal data beyond your session.