Authentication
MapsIndoors.getAuthenticationDetails("apikey", authDetails -> {
//Check if authdetails is not null and auth is required for the api
if (authDetails != null && authDetails.isAuthRequired) {
//Through the authDetails you can retrieve the necessary data to create a auth request. Here is an example through the appAuth library
AuthorizationServiceConfiguration.fetchFromIssuer(Uri.parse(authDetails.getAuthIssuer()), (serviceConfiguration, ex) -> {
if (serviceConfiguration != null) {
authorizationRequest = new AuthorizationRequest.Builder(serviceConfiguration, authDetails.getAuthClients().get(0).getClientId(), ResponseTypeValues.CODE, Uri.parse("redirectUri"))
.setAdditionalParameters(Collections.singletonMap("acr_values", "idp:" + authDetails.getAuthClients().get(0).getPreferredIDPs().get(0)))
.setScope("openid profile account client-apis").build();
authorizationService = new AuthorizationService(this);
Intent authIntent = authorizationService.getAuthorizationRequestIntent(authorizationRequest);
startActivity(authIntent);
}
}
}
}Last updated
Was this helpful?