Anonymous authentication

Note

The article is being updated.

Below are examples of the code for anonymous authentication in different YDB SDKs.

Go

Java

  1. package main
  2. import (
  3. "context"
  4. "github.com/ydb-platform/ydb-go-sdk/v3"
  5. )
  6. func main() {
  7. ctx, cancel := context.WithCancel(context.Background())
  8. defer cancel()
  9. db, err := ydb.Open(
  10. ctx,
  11. os.Getenv("YDB_CONNECTION_STRING"),
  12. ydb.WithAnonymousCredentials(),
  13. )
  14. if err != nil {
  15. panic(err)
  16. }
  17. defer func() {
  18. _ = db.Close(ctx)
  19. }()
  20. }

Anonymous - 图1

  1. public void work(String connectionString) {
  2. AuthProvider authProvider = NopAuthProvider.INSTANCE;
  3. GrpcTransport transport = GrpcTransport.forConnectionString(connectionString)
  4. .withAuthProvider(authProvider)
  5. .build();
  6. TableClient tableClient = TableClient
  7. .newClient(GrpcTableRpc.ownTransport(transport))
  8. .build());
  9. doWork(tableClient);
  10. tableClient.close();
  11. }

Anonymous - 图2