protected TokenRequest createTokenRequest(final AuthorizationGrant grant) {
        val metadataResolver = configuration.getOpMetadataResolver();
        val tokenEndpointUri = metadataResolver.load().getTokenEndpointURI();
        val clientAuthentication = metadataResolver.getClientAuthentication();
        if (clientAuthentication != null) {
            return new TokenRequest(
                    tokenEndpointUri, clientAuthentication, grant, Scope.parse(configuration.getScope()));
        } else {
            return new TokenRequest(
                    tokenEndpointUri, new ClientID(configuration.getClientId()), grant, Scope.parse(configuration.getScope()));
        }
    }
<p>createTokenRequest.</p>

@param grant a {@link AuthorizationGrant} object
@return a {@link TokenRequest} object
pac4j-oidc/src/main/java/org/pac4j/oidc/credentials/authenticator/OidcAuthenticator.java