From ff6e0adba2052595cdfabcc51797b39e116c0873 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Wed, 22 Nov 2023 12:19:59 +0100 Subject: [PATCH 1/4] Feat: auth manager refactoring enabling to have dedicated managers to each underline APIs (#14) * docs: typo & javadoc * refactor: Attach Auth manager at API level. Because of OAS files could cause conflicts with same scheme name alias for different managers, dedicated service's auth managers are stored at API level and no longer at HttpClient level (http client is shared across all APIs for sinch client SDK library) * feat: synchronize generated sources from OAS file --- client/src/main/com/sinch/sdk/SinchClient.java | 1 - client/src/main/com/sinch/sdk/http/HttpClientApache.java | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/main/com/sinch/sdk/SinchClient.java b/client/src/main/com/sinch/sdk/SinchClient.java index ecc28d41..68434532 100644 --- a/client/src/main/com/sinch/sdk/SinchClient.java +++ b/client/src/main/com/sinch/sdk/SinchClient.java @@ -189,7 +189,6 @@ private Properties handlePropertiesFile(String fileName) { private HttpClientApache getHttpClient() { if (null == httpClient || httpClient.isClosed()) { - // TODO: by adding a setter, we could imagine having another HTTP client provided // programmatically or use // configuration file referencing another class by name diff --git a/client/src/main/com/sinch/sdk/http/HttpClientApache.java b/client/src/main/com/sinch/sdk/http/HttpClientApache.java index 695758e6..e76e56e2 100644 --- a/client/src/main/com/sinch/sdk/http/HttpClientApache.java +++ b/client/src/main/com/sinch/sdk/http/HttpClientApache.java @@ -232,6 +232,7 @@ private void addAuth( Map authManagersByOasSecuritySchemes, Collection values, String body) { + if (null == values || values.isEmpty() || null == authManagersByOasSecuritySchemes) { return; } From 9539275235d9d6a739f0cbc4a884701959ad0607 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier <141755467+JPPortier@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:52:21 +0100 Subject: [PATCH 2/4] Verification API: application auth manager + report & status APIs --- sample-app/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sample-app/README.md b/sample-app/README.md index 6c37deda..d1d947fd 100644 --- a/sample-app/README.md +++ b/sample-app/README.md @@ -49,7 +49,6 @@ See https://developers.sinch.com for details about these parameters ## Available samples classes -<<<<<<< HEAD ### Full workflow A full application chaining calls to Numbers service to onboard onto Java SDK and Numbers: [NumbersSampleFlow](src/main/java/com/sinch/sample/numbers/NumbersSampleFlow.java) @@ -68,7 +67,7 @@ A full application chaining calls to Numbers service to onboard onto Java SDK an | | | - Update | [com.sinch.sample.numbers.active.Update](src/main/java/com/sinch/sample/numbers/active/Update.java) | Require `PHONE_NUMBER` parameter | | | Callback | - Get | [com.sinch.sample.numbers.callback.Get](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | | | | - Update | [com.sinch.sample.numbers.callback.Update](src/main/java/com/sinch/sample/numbers/callback/Get.java) | | -| | Regions | - ListAll | [com.sinch.sample.numbers.regions.ListAll](src/main/java/com/sinch/sample/numbers/regions/ListAll.java) | | +| | Regions | - ListAll | [com.sinch.sample.numbers.regions.List](src/main/java/com/sinch/sample/numbers/regions/List.java) | | | SMS | Batches | - Get | [com.sinch.sample.sms.batches.Get](src/main/java/com/sinch/sample/sms/batches/Get.java) | Require `BATCH_ID` parameter | | | | - List | [com.sinch.sample.sms.batches.List](src/main/java/com/sinch/sample/sms/batches/List.java) | | | | | - Send | [com.sinch.sample.sms.batches.Send](src/main/java/com/sinch/sample/sms/batches/Send.java) | | From a1c20df34684064b91208920b7d375249e375b89 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Mon, 27 Nov 2023 18:13:11 +0100 Subject: [PATCH 3/4] feat: Enable Application id/secret to supersed Sinch default configuration for dedicated credentials --- .gitignore | 4 ++- .../sdk/auth/adapters/BasicAuthManager.java | 8 ++++-- .../sdk/auth/adapters/BearerAuthManager.java | 11 +++++++- .../verification/VerificationService.java | 11 ++++++++ .../adapters/VerificationService.java | 25 ++++++++++++------- .../com/sinch/sample/BaseApplication.java | 25 ++++++++++++++++++- 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 1e454e12..f5b35d88 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,6 @@ buildNumber.properties # JDT-specific (Eclipse Java Development Tools) .classpath .idea -*.iml \ No newline at end of file +*.iml + +sample-app/src/main/resources/config.properties diff --git a/client/src/main/com/sinch/sdk/auth/adapters/BasicAuthManager.java b/client/src/main/com/sinch/sdk/auth/adapters/BasicAuthManager.java index 1f04fdc5..e9a13a28 100644 --- a/client/src/main/com/sinch/sdk/auth/adapters/BasicAuthManager.java +++ b/client/src/main/com/sinch/sdk/auth/adapters/BasicAuthManager.java @@ -15,8 +15,12 @@ public class BasicAuthManager implements AuthManager { private final String keySecret; public BasicAuthManager(Configuration configuration) { - this.keyId = configuration.getKeyId(); - this.keySecret = configuration.getKeySecret(); + this(configuration.getKeyId(), configuration.getKeySecret()); + } + + public BasicAuthManager(String keyId, String keySecret) { + this.keyId = keyId; + this.keySecret = keySecret; } public String getSchema() { diff --git a/client/src/main/com/sinch/sdk/auth/adapters/BearerAuthManager.java b/client/src/main/com/sinch/sdk/auth/adapters/BearerAuthManager.java index f5e41c88..b0a332a8 100644 --- a/client/src/main/com/sinch/sdk/auth/adapters/BearerAuthManager.java +++ b/client/src/main/com/sinch/sdk/auth/adapters/BearerAuthManager.java @@ -34,11 +34,20 @@ public class BearerAuthManager implements AuthManager { private String token; public BearerAuthManager(Configuration configuration, HttpMapper mapper, HttpClient httpClient) { + this(configuration.getKeyId(), configuration.getKeySecret(), configuration, mapper, httpClient); + } + + public BearerAuthManager( + String keyId, + String keySecret, + Configuration configuration, + HttpMapper mapper, + HttpClient httpClient) { this.oAuthServer = configuration.getOAuthServer(); this.mapper = mapper; this.httpClient = httpClient; - AuthManager basicAuthManager = new BasicAuthManager(configuration); + AuthManager basicAuthManager = new BasicAuthManager(keyId, keySecret); authManagers = Stream.of(new AbstractMap.SimpleEntry<>(SCHEMA_KEYWORD_BASIC, basicAuthManager)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); diff --git a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java index a97ee08d..c555334d 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java @@ -9,6 +9,17 @@ */ public interface VerificationService { + /** + * Use application secret in place of unified configuration for authentication (see Sinch + * dashboard for details) + * + * @param key see dashboard + * @param secret see dashboard + * @return service instance for project + * @since 1.0 + */ + VerificationService useSecrets(String key, String secret); + /** * Verifications Service instance * diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java index 536c7ef7..432e56af 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java @@ -7,7 +7,9 @@ import com.sinch.sdk.domains.verification.StatusService; import com.sinch.sdk.domains.verification.VerificationsService; import com.sinch.sdk.models.Configuration; +import java.nio.charset.StandardCharsets; import java.util.AbstractMap; +import java.util.Base64; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -22,28 +24,33 @@ public class VerificationService implements com.sinch.sdk.domains.verification.V private final HttpClient httpClient; private VerificationsService verifications; private StatusService status; - private final Map authManagers; + private Map authManagers; public VerificationService(Configuration configuration, HttpClient httpClient) { this.configuration = configuration; this.httpClient = httpClient; + // by default, unified id/secret from configuration are used but can be super sed if + // "useSecrets" + // is called after initialization + useSecrets( + configuration.getKeyId(), + Base64.getEncoder() + .encodeToString(configuration.getKeySecret().getBytes(StandardCharsets.UTF_8))); + } + + public VerificationService useSecrets(String key, String secret) { AuthManager authManager; boolean useApplicationAuth = true; if (useApplicationAuth) { - authManager = - new VerificationApplicationAuthManager( - configuration.getKeyId(), - // TODO: Currently Verification do not accept project related key/secret. TBC - // fallback to the verifications usage ones for POC - // Base64.getEncoder().encodeToString(configuration.getKeySecret().getBytes(StandardCharsets.UTF_8)) - configuration.getKeySecret()); + authManager = new VerificationApplicationAuthManager(key, secret); } else { - authManager = new BasicAuthManager(configuration); + authManager = new BasicAuthManager(key, secret); } authManagers = Stream.of(new AbstractMap.SimpleEntry<>(SECURITY_SCHEME_KEYWORD_VERIFICATION, authManager)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + return this; } public VerificationsService verifications() { diff --git a/sample-app/src/main/java/com/sinch/sample/BaseApplication.java b/sample-app/src/main/java/com/sinch/sample/BaseApplication.java index e114e055..59777e21 100644 --- a/sample-app/src/main/java/com/sinch/sample/BaseApplication.java +++ b/sample-app/src/main/java/com/sinch/sample/BaseApplication.java @@ -7,13 +7,17 @@ import java.util.logging.Logger; public abstract class BaseApplication { - private static final String BATCH_ID_KEY = "BATCH_ID"; private static final String PHONE_NUMBER_KEY = "PHONE_NUMBER"; protected static final Logger LOGGER = Utils.initializeLogger(BaseApplication.class.getName()); + // can super sed unified Sinch credentials if defined + private static final String VERIFICATION_API_KEY = "VERIFICATION_API_KEY"; + private static final String VERIFICATION_API_SECRET = "VERIFICATION_API_SECRET"; + protected SinchClient client; + protected String phoneNumber; protected String batchId; @@ -34,6 +38,25 @@ protected BaseApplication() throws IOException { : properties.getProperty(BATCH_ID_KEY); client = new SinchClient(configuration); + + handleVerificationCredentials(client, properties); + } + + void handleVerificationCredentials(SinchClient client, Properties props) { + + String verificationApiKey = + null != System.getenv(VERIFICATION_API_KEY) + ? System.getenv(VERIFICATION_API_KEY) + : props.getProperty(VERIFICATION_API_KEY); + String verificationApiSecret = + null != System.getenv(VERIFICATION_API_SECRET) + ? System.getenv(VERIFICATION_API_SECRET) + : props.getProperty(VERIFICATION_API_SECRET); + + // super-sed unified key/secret for verification API + if (null != verificationApiKey && null != verificationApiSecret) { + client.verification().useSecrets(verificationApiKey, verificationApiSecret); + } } public abstract void run(); From 94133e16dfa9d57bf3fb6e281844477a92b338ce Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Sat, 2 Dec 2023 16:29:22 +0100 Subject: [PATCH 4/4] feat: use "setApplicationCredentials" for verification service credentials --- .../verification/VerificationService.java | 8 ++--- .../verification/adapters/StatusService.java | 25 +++++++++------ .../adapters/VerificationService.java | 31 +++++++++++-------- .../adapters/VerificationsService.java | 25 +++++++++------ .../adapters/StatusServiceTest.java | 21 +++++++++++-- .../adapters/VerificationsServiceTest.java | 21 +++++++++++-- .../com/sinch/sample/BaseApplication.java | 2 +- 7 files changed, 91 insertions(+), 42 deletions(-) diff --git a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java index c555334d..d54585ce 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/VerificationService.java @@ -11,14 +11,14 @@ public interface VerificationService { /** * Use application secret in place of unified configuration for authentication (see Sinch - * dashboard for details) + * dashboard for details) These credentials are related to Verification Apps * - * @param key see dashboard - * @param secret see dashboard + * @param key see dashboard + * @param secret see dashboard * @return service instance for project * @since 1.0 */ - VerificationService useSecrets(String key, String secret); + VerificationService setApplicationCredentials(String key, String secret); /** * Verifications Service instance diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/StatusService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/StatusService.java index 4fbb2237..675b86aa 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/StatusService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/adapters/StatusService.java @@ -14,22 +14,29 @@ import com.sinch.sdk.domains.verification.models.VerificationReport; import com.sinch.sdk.models.Configuration; import java.util.Map; +import java.util.function.Supplier; public class StatusService implements com.sinch.sdk.domains.verification.StatusService { - private QueryVerificationsApi api; - - public StatusService() {} + private final Configuration configuration; + private final HttpClient httpClient; + private final Supplier> authManagerSupplier; public StatusService( - Configuration configuration, HttpClient httpClient, Map authManager) { - this.api = - new QueryVerificationsApi( - httpClient, configuration.getVerificationServer(), authManager, new HttpMapper()); + Configuration configuration, + HttpClient httpClient, + Supplier> authManagerSupplier) { + this.configuration = configuration; + this.httpClient = httpClient; + this.authManagerSupplier = authManagerSupplier; } - private QueryVerificationsApi getApi() { - return this.api; + protected QueryVerificationsApi getApi() { + return new QueryVerificationsApi( + httpClient, + configuration.getVerificationServer(), + authManagerSupplier.get(), + new HttpMapper()); } public VerificationReport get(Identity identity, VerificationMethodType method) { diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java index 432e56af..07e5285a 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationService.java @@ -2,15 +2,15 @@ import com.sinch.sdk.auth.adapters.BasicAuthManager; import com.sinch.sdk.auth.adapters.VerificationApplicationAuthManager; +import com.sinch.sdk.core.exceptions.ApiAuthException; import com.sinch.sdk.core.http.AuthManager; import com.sinch.sdk.core.http.HttpClient; import com.sinch.sdk.domains.verification.StatusService; import com.sinch.sdk.domains.verification.VerificationsService; import com.sinch.sdk.models.Configuration; -import java.nio.charset.StandardCharsets; import java.util.AbstractMap; -import java.util.Base64; import java.util.Map; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -25,21 +25,15 @@ public class VerificationService implements com.sinch.sdk.domains.verification.V private VerificationsService verifications; private StatusService status; private Map authManagers; + private final Supplier> authManagersSupplier = () -> authManagers; public VerificationService(Configuration configuration, HttpClient httpClient) { this.configuration = configuration; this.httpClient = httpClient; - - // by default, unified id/secret from configuration are used but can be super sed if - // "useSecrets" - // is called after initialization - useSecrets( - configuration.getKeyId(), - Base64.getEncoder() - .encodeToString(configuration.getKeySecret().getBytes(StandardCharsets.UTF_8))); } - public VerificationService useSecrets(String key, String secret) { + public VerificationService setApplicationCredentials(String key, String secret) { + AuthManager authManager; boolean useApplicationAuth = true; if (useApplicationAuth) { @@ -55,19 +49,30 @@ public VerificationService useSecrets(String key, String secret) { public VerificationsService verifications() { if (null == this.verifications) { + checkCredentials(); this.verifications = new com.sinch.sdk.domains.verification.adapters.VerificationsService( - configuration, httpClient, authManagers); + configuration, httpClient, authManagersSupplier); } return this.verifications; } public StatusService status() { if (null == this.status) { + checkCredentials(); this.status = new com.sinch.sdk.domains.verification.adapters.StatusService( - configuration, httpClient, authManagers); + configuration, httpClient, authManagersSupplier); } return this.status; } + + private void checkCredentials() throws ApiAuthException { + if (null == authManagers || authManagers.isEmpty()) { + throw new ApiAuthException( + String.format( + "Service '%s' cannot be called without defined credentials", + this.getClass().getSimpleName())); + } + } } diff --git a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java index 72266423..3fe7a5f4 100644 --- a/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java +++ b/client/src/main/com/sinch/sdk/domains/verification/adapters/VerificationsService.java @@ -15,23 +15,30 @@ import com.sinch.sdk.domains.verification.models.response.StartVerificationResponse; import com.sinch.sdk.models.Configuration; import java.util.Map; +import java.util.function.Supplier; public class VerificationsService implements com.sinch.sdk.domains.verification.VerificationsService { - private SendingAndReportingVerificationsApi api; - - public VerificationsService() {} + private final Configuration configuration; + private final HttpClient httpClient; + private final Supplier> authManagerSupplier; public VerificationsService( - Configuration configuration, HttpClient httpClient, Map authManager) { - this.api = - new SendingAndReportingVerificationsApi( - httpClient, configuration.getVerificationServer(), authManager, new HttpMapper()); + Configuration configuration, + HttpClient httpClient, + Supplier> authManagerSupplier) { + this.configuration = configuration; + this.httpClient = httpClient; + this.authManagerSupplier = authManagerSupplier; } - private SendingAndReportingVerificationsApi getApi() { - return this.api; + protected SendingAndReportingVerificationsApi getApi() { + return new SendingAndReportingVerificationsApi( + httpClient, + configuration.getVerificationServer(), + authManagerSupplier.get(), + new HttpMapper()); } public StartVerificationResponse start(StartVerificationRequestParameters parameters) { diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/StatusServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/StatusServiceTest.java index f3378ce8..c38b25d4 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/StatusServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/StatusServiceTest.java @@ -1,11 +1,15 @@ package com.sinch.sdk.domains.verification.adapters; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import com.adelean.inject.resources.junit.jupiter.TestWithResources; import com.sinch.sdk.BaseTest; import com.sinch.sdk.core.exceptions.ApiException; +import com.sinch.sdk.core.http.AuthManager; +import com.sinch.sdk.core.http.HttpClient; import com.sinch.sdk.domains.verification.adapters.api.v1.QueryVerificationsApi; import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverterTest; import com.sinch.sdk.domains.verification.models.NumberIdentity; @@ -15,17 +19,28 @@ import com.sinch.sdk.domains.verification.models.VerificationReport; import com.sinch.sdk.domains.verification.models.dto.v1.VerificationReportDtoTest; import com.sinch.sdk.models.Configuration; +import java.util.Map; +import java.util.function.Supplier; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; import org.mockito.Mock; @TestWithResources public class StatusServiceTest extends BaseTest { - @Mock Configuration configuration; @Mock QueryVerificationsApi api; - @InjectMocks StatusService service; + @Mock Configuration configuration; + @Mock HttpClient httpClient; + @Mock Supplier> authManagerSupplier; + + StatusService service; + + @BeforeEach + public void initMocks() { + service = spy(new StatusService(configuration, httpClient, authManagerSupplier)); + doReturn(api).when(service).getApi(); + } @Test void getByIdentity() throws ApiException { diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsServiceTest.java index a41c11b9..f6d7c54e 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/adapters/VerificationsServiceTest.java @@ -1,12 +1,16 @@ package com.sinch.sdk.domains.verification.adapters; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import com.adelean.inject.resources.junit.jupiter.GivenJsonResource; import com.adelean.inject.resources.junit.jupiter.TestWithResources; import com.sinch.sdk.BaseTest; import com.sinch.sdk.core.exceptions.ApiException; +import com.sinch.sdk.core.http.AuthManager; +import com.sinch.sdk.core.http.HttpClient; import com.sinch.sdk.domains.verification.adapters.api.v1.SendingAndReportingVerificationsApi; import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverterTest; import com.sinch.sdk.domains.verification.models.NumberIdentity; @@ -18,9 +22,11 @@ import com.sinch.sdk.domains.verification.models.dto.v1.VerificationReportRequestResourceDto; import com.sinch.sdk.domains.verification.models.response.StartVerificationResponse; import com.sinch.sdk.models.Configuration; +import java.util.Map; +import java.util.function.Supplier; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; import org.mockito.Mock; @TestWithResources @@ -32,9 +38,18 @@ public class VerificationsServiceTest extends BaseTest { @GivenJsonResource("/domains/verification/v1/VerificationReportCalloutRequestDto.json") public VerificationReportRequestResourceDto verificationReportRequestResourceDto; - @Mock Configuration configuration; @Mock SendingAndReportingVerificationsApi api; - @InjectMocks VerificationsService service; + @Mock Configuration configuration; + @Mock HttpClient httpClient; + @Mock Supplier> authManagerSupplier; + + VerificationsService service; + + @BeforeEach + public void initMocks() { + service = spy(new VerificationsService(configuration, httpClient, authManagerSupplier)); + doReturn(api).when(service).getApi(); + } @Test void start() throws ApiException { diff --git a/sample-app/src/main/java/com/sinch/sample/BaseApplication.java b/sample-app/src/main/java/com/sinch/sample/BaseApplication.java index 59777e21..0bdff306 100644 --- a/sample-app/src/main/java/com/sinch/sample/BaseApplication.java +++ b/sample-app/src/main/java/com/sinch/sample/BaseApplication.java @@ -55,7 +55,7 @@ void handleVerificationCredentials(SinchClient client, Properties props) { // super-sed unified key/secret for verification API if (null != verificationApiKey && null != verificationApiSecret) { - client.verification().useSecrets(verificationApiKey, verificationApiSecret); + client.verification().setApplicationCredentials(verificationApiKey, verificationApiSecret); } }