Authentication using environment variables
The article is being updated.
When using this method, the authentication mode and its parameters are defined by the environment that an application is run in, as described here.
- : Use a service account file in Yandex.Cloud.
YDB_ANONYMOUS_CREDENTIALS="1"
: Use anonymous authentication. Relevant for testing against a Docker container with YDBYDB_METADATA_CREDENTIALS="1"
: Use the metadata service inside Yandex.Cloud (a Yandex function or a VM).YDB_ACCESS_TOKEN_CREDENTIALS=<access_token>
: Use token-based authentication.
Below are examples of the code for authentication using environment variables in different YDB SDKs.
Go
public void work(String connectionString) {
GrpcTransport transport = GrpcTransport.forConnectionString(connectionString)
.withAuthProvider(authProvider)
.build();
.build());
doWork(tableClient);