Client Keys
Create the client key that goes inside your app, and see what it can and cannot do.
A client key is the API key that goes inside your app. It starts with rv_client_, or rv_live_ for a key converted from legacy. Every user of the app holds it, so it is treated as public. It can only do what an app needs on a device.
A client key is bound to one project, chosen when you create it, and reaches only that project. See Authentication for how it compares with a secret key.
Create a client key
You need a project in ReactVision Studio first. See Getting Started with ReactVision Spatial for creating one and copying its project ID.
- In your team's sidebar, under Integrations, click API Keys
- Click Create Key
- Enter a Key Name (e.g. "My AR App - Production")
- Under Key type, choose Client key
- Under Project, choose your app's project. A client key reaches only this project.
- Leave Expiration at No expiration. A key that ships in an app stops working on its expiry date, and the app with it.
- Click Create, then Copy Key
Keep this handy: you will use this value as
rvApiKey, and the project's ID asrvProjectId. Studio can show a client key again at any time: click the eye icon on its row.
Use it in your app
Set the client key as rvApiKey and its project's ID as rvProjectId. rvProjectId must be the project that key belongs to. With Expo, add both to your app.json plugin configuration:
{
"plugins": [
[
"@reactvision/react-viro",
{
"provider": "reactvision",
"rvApiKey": "YOUR_REACTVISION_CLIENT_KEY",
"rvProjectId": "YOUR_REACTVISION_PROJECT_ID"
}
]
]
}
See Integrating ViroReact with Expo for the full plugin configuration reference. For bare React Native projects, add the entries yourself:
iOS (bare React Native)
Add the following keys to your Info.plist:
<key>RVApiKey</key>
<string>YOUR_REACTVISION_CLIENT_KEY</string>
<key>RVProjectId</key>
<string>YOUR_REACTVISION_PROJECT_ID</string>
Android (bare React Native)
Add the following <meta-data> entries inside the <application> tag in your AndroidManifest.xml:
<meta-data
android:name="com.reactvision.RVApiKey"
android:value="YOUR_REACTVISION_CLIENT_KEY" />
<meta-data
android:name="com.reactvision.RVProjectId"
android:value="YOUR_REACTVISION_PROJECT_ID" />
For co-location, pass the client key as apiKey and its project as projectId. See Co-Location.
What a client key can do
- Host, resolve and find cloud and geospatial anchors
- Upload anchor files
- Record resolve analytics
- Load Studio scenes and projects, and run a scene's API requests (see StudioSceneNavigator)
- Join co-location rooms of its own project
Uploading images, videos and 3D models with rvUploadAsset is different: it needs a secret key.
Cloud Anchors
A client key can call these Cloud Anchors methods:
hostCloudAnchorandresolveCloudAnchorrvGetCloudAnchor(anchorId)rvFindNearbyCloudAnchors(lat, lng, radius, limit)rvTrackCloudAnchorResolution(...)
Geospatial Anchors
A client key can call these Geospatial Anchors methods:
rvGetGeospatialAnchorrvFindNearbyGeospatialAnchorshostGeospatialAnchorresolveGeospatialAnchor
A secret key can call all of these too.
What a client key gets back
A client key ships inside an app, so every user of the app holds it. For that reason it gets less back than a secret key, even on the operations it can call.
-
Fields that identify people are left out. Reading an anchor leaves out the fields that identify its creator or another app user:
created_bycreated_by_api_keyexternal_user_idexternal_user_metadata- for geospatial anchors, also
creator_dataand the linked file'sexternal_user_id
metadatais your own data and is always returned. -
Private anchors do not exist to it. A private cloud anchor (
isPublic: false) is reachable only with a secret key or a Studio session. A client key cannot create one either. -
Smaller nearby searches.
rvFindNearbyCloudAnchorsandrvFindNearbyGeospatialAnchorsreturn at most 50 anchors within 1,000 m.
Restrictions
-
One project only. A bound key can only act on its own project. An anchor, scene or file of any other project is answered exactly as if it did not exist. So
StudioSceneNavigatorcannot open a scene from another project, and co-location joins only rooms of the key's own project. -
No secret-key operations. These are refused with 403
API_KEY_TYPE_NOT_ALLOWED, which ViroReact reports as "This endpoint does not accept this type of API key":- listing, editing and deleting anchors
- attaching content to anchors
- uploading images, videos and 3D models
- reading and deleting app users' files
- AI generation
See Secret Keys.
Next Steps
- Secret Keys: the backend key for what a client key cannot do
- Authentication: project binding, replacing keys, legacy keys and errors
Updated about 1 hour ago