Search in sources :

Example 1 with TokenHolder

use of com.auth0.json.auth.TokenHolder in project CollectiveOneWebapp by CollectiveOne.

the class Auth0Management method managementAPI.

@Bean
public ManagementAPI managementAPI() {
    String token = "";
    AuthRequest authRequest = authAPI.requestToken("https://collectiveone.auth0.com/api/v2/");
    try {
        TokenHolder holder = authRequest.execute();
        token = holder.getAccessToken();
    } catch (APIException exception) {
        System.out.println(exception.getMessage());
    } catch (Auth0Exception exception) {
        System.out.println(exception.getMessage());
    }
    return new ManagementAPI(issuer, token);
}
Also used : AuthRequest(com.auth0.net.AuthRequest) ManagementAPI(com.auth0.client.mgmt.ManagementAPI) APIException(com.auth0.exception.APIException) Auth0Exception(com.auth0.exception.Auth0Exception) TokenHolder(com.auth0.json.auth.TokenHolder) Bean(org.springframework.context.annotation.Bean)

Aggregations

ManagementAPI (com.auth0.client.mgmt.ManagementAPI)1 APIException (com.auth0.exception.APIException)1 Auth0Exception (com.auth0.exception.Auth0Exception)1 TokenHolder (com.auth0.json.auth.TokenHolder)1 AuthRequest (com.auth0.net.AuthRequest)1 Bean (org.springframework.context.annotation.Bean)1