@SuppressWarnings("WeakerAccess")
    public ParameterizableRequest<Credentials, AuthenticationException> renewAuth(@NonNull String refreshToken) {
        final Map<String, Object> parameters = ParameterBuilder.newBuilder()
                .setClientId(getClientId())
                .setRefreshToken(refreshToken)
                .setGrantType(auth0.isOIDCConformant() ? ParameterBuilder.GRANT_TYPE_REFRESH_TOKEN : ParameterBuilder.GRANT_TYPE_JWT)
                .asDictionary();

        HttpUrl url;
        if (auth0.isOIDCConformant()) {
            url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
                    .addPathSegment(OAUTH_PATH)
                    .addPathSegment(TOKEN_PATH)
                    .build();
        } else {
            url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
                    .addPathSegment(DELEGATION_PATH)
                    .build();
        }

        return factory.POST(url, client, gson, Credentials.class, authErrorBuilder)
                .addParameters(parameters);
    }
@ SuppressWarnings ( "WeakerAccess" ) public ParameterizableRequest < Credentials , AuthenticationException > renewAuth ( @ NonNull String refreshToken ) { final Map < String , Object > parameters = ParameterBuilder . newBuilder ( ) . setClientId ( getClientId ( ) ) . setRefreshToken ( refreshToken ) . setGrantType ( auth0 . isOIDCConformant ( ) ? ParameterBuilder . GRANT_TYPE_REFRESH_TOKEN : ParameterBuilder . GRANT_TYPE_JWT ) . asDictionary ( ) ; HttpUrl url ; if ( auth0 . isOIDCConformant ( ) ) { url = HttpUrl . parse ( auth0 . getDomainUrl ( ) ) . newBuilder ( ) . addPathSegment ( OAUTH_PATH ) . addPathSegment ( TOKEN_PATH ) . build ( ) ; } else { url = HttpUrl . parse ( auth0 . getDomainUrl ( ) ) . newBuilder ( ) . addPathSegment ( DELEGATION_PATH ) . build ( ) ; } return factory . POST ( url , client , gson , Credentials . class , authErrorBuilder ) . addParameters ( parameters ) ; }
Requests new Credentials using a valid Refresh Token. The received token will have the same audience and scope as first requested. How the new Credentials are requested depends on the {@link Auth0#isOIDCConformant()} flag.
- If the instance is OIDC Conformant the endpoint will be /oauth/token with 'refresh_token' grant, and the response will include an id_token and an access_token if 'openid' scope was requested when the refresh_token was obtained.
- If the instance is not OIDC Conformant the endpoint will be /delegation with 'urn:ietf:params:oauth:grant-type:jwt-bearer' grant, and the response will include an id_token.
Example usage:
<pre>
{@code
client.renewAuth("{refresh_token}")
.addParameter("scope", "openid profile email")
.start(new BaseCallback<Credentials>() {
{@literal}Override
public void onSuccess(Credentials payload) { }

{@literal}@Override
public void onFailure(AuthenticationException error) { }
});
}
</pre>

@param refreshToken used to fetch the new Credentials.
@return a request to start