Help Center> Object Storage Service> SDK Reference> Java> Initialization> Transparently Transferring the AK and SK

Transparently Transferring the AK and SK

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

OBS Java SDK provides SecretFlexibleObsClient that supports transparent transfer of AKs and SKs in API functions. Sample code is as follows:

String endPoint = "https://your-endpoint";
// Create an ObsConfiguration instance.
ObsConfiguration config = new ObsConfiguration();
config.setEndPoint(endPoint);

// Create a SecretFlexibleObsClient instance.
SecretFlexibleObsClient obsClient = new SecretFlexibleObsClient(config);
// Use the instance to access OBS.
String ak1 = "*** Provide your Access Key 1 ***";
String sk1 = "*** Provide your Secret Key 1 ***";
obsClient.listBuckets(ak1, sk1);

String ak2 = "*** Provide your Access Key 2 ***";
String sk2 = "*** Provide your Secret Key 2 ***";
obsClient.listBuckets(ak2, sk2);

// Close obsClient.
obsClient.close();

SecretFlexibleObsClient is inherited from ObsClient and can be used as ObsClient.