Authentication in the SDK
An app holds a publishable key and a session token your server mints. The client keeps the token fresh and sends both on every request. Authentication explains the credentials themselves.
Your server mints a session token with its secret key, through the admin product:
Answer the app with JSONEncoder().encode(session).
SessionTokenEngine asks your server for a token, and asks again before it expires. The app reads your server's address, MOUNTAYA_SESSION_URL, from Info.plist:
A request waits for the first token. Each later request sends the token the engine holds.
A share link carries a share token. It replaces the key, so a visitor needs no key and no session:
A map built over that client draws the shared itinerary the same way.
A write acts as a member of your organization. Mint the session for the studio-embedded product and name the member, then write with it:
The publishable key needs the studio-embedded scope. Every write made under that token is that member's.
.secret(key:) exists only on macOS and Linux. An iOS, iPadOS, tvOS, watchOS, visionOS or Mac Catalyst build cannot name it, so the compiler stops a secret key from shipping in an app:
Keep the secret key in your server's environment, and never in Info.plist or an xcconfig.