Basics of authentication
Learn about the basics of authentication in Supervisely
Last updated
Was this helpful?
Learn about the basics of authentication in Supervisely
Last updated
Was this helpful?
The easiest and best way to authenticate with the Supervisely API is by using Basic Authentication via a personal access token.
You need only two environment variables:
- address of your Supervisely instance
- your personal access token
SERVER_ADDRESS
envIf you are using 🔐 Enterprise Edition 🔐 you have your own instance address. You can copy the URL address from the browser or contact instance admin. For example on my private instance the address is the following:
In the example above the server address is https://dev.supervisely.com
API_TOKEN
envEvery basic account has its own personal access token in account settings:
Find Account Settings
under your name in the right top corner.
Go to API Token
tab.
Press copy button.
You can revoke your current token and generate the new one at any time by clicking re-generate api key
button.
Use .env
file - recommended 👍
It is the default practice to store your secrets as environment variables and keep them safe in .env
files for local development.
Create .env file (recommended: ~/supervisely.env
) with the following content:
2. Use it the following way
Pass values into the API constructor - optional, not recommended
We do not recommend using this way in production. It is the fastest way, but remember, it is not safe to store the secrets right in your sources. Avoid (accidentally) committing (exposing) your private keys, passwords or other sensitive details (by hard-coding in them in your script) to Git by storing them as environment variables.
Beta. Release coming soon.
Command options:
-s
/ --server-address
- Server address.
-l
/ --login
- User login.
-p
/ --password
- User password.
This will help you automatically create the .env
file. If you have this file and try to log in as a different user, the existing .env
file will be overwritten. A backup file will be created for the previous .env
file. Backup files will be saved for the last 5 authorizations.
You can try examples shown in the video for yourself: find the repository with the scripts on .
If you are using Community Edition your server address is https://app.supervisely.com
To communicate with the Supervisely platform, you first need to instantiate a client. The easiest way to do that is by calling the function or pass values of environment variables in the .
If you already use or are about to install our , you will be able to do all the .env
file preparation using just one command.
More information you can find on