Authentication - Map SDK
Authentication
Map SDK uses an API Key to associate API requests with your account and provide additional control and security for your maps.
Viewing API Keys
After logging in to Foursquare Studio, navigate to: Workspace > API Keys.
API Keys are shared within an Organization. All members of the same Studio Organization can view, create, update and delete any of the Map SDK API Keys.
If your account is not part of any organization, only your account is able to access and manage your Map SDK API Keys.
Generating a new API Key
- To create a new API Key, click on "Generate API Key" button:
- A dialog will show up asking you to name your API Key:
API Key's name is not considered secret and will be visible to anyone managing API Keys, and only helps you locate it in the list more easily.
- The next step of the wizard will show you the newly generated API Key's secret:
This value is the API Key, an opaque string. Use this value to initialize Map SDK.
This is the only time you'll be able to see an API Key's secret value, so make sure to copy it and safely store it somewhere.
- The newly generated API Key will appear in the list with all the other API Keys.
Updating API Key's settings
In the list of all API Keys, find the API Key you want to update the settings for, and click on "Modify":
You will be presented with a dialog that allows you to update the list of restricted URLs for that specific API Key.
URL restrictions are used to make your maps more secure. When you add a URL restriction to an API Key, that API Key will only work for requests that originate from the URLs you specified. API Keys without restrictions will work for requests originating from any URL.
Removing an API Key
To delete an API Key, find it in the list and click on "Remove API Key":
Once you remove the API Key, all maps using that API Key will stop working. If you plan to have your maps continue working, you will have to pick some other API Key, or generate a new one, and update your maps to use the new value.
Using the API Key with Map SDK
To use the API Key, pass its value to the apiKey
parameter whenever you are creating a map:
createMap({
apiKey: "<api-key>"
})
create_map(
api_key="<api-key>"
)
Updated 6 months ago