First you need to include the Auth0 script tag in your HTML:
<script src="https://cdn.auth0.com/js/lock/10.8/lock.min.js"></script>
Or, if you installed from npm, you may need Auth0:
var Auth0 = require("auth0-js");
In V10, you create an instance of the Auth0 client (separate from the Auth0Lock instance), which has a refreshToken() function:
var auth0 = new Auth0({clientID: YOUR_CLIENT_ID, domain: YOUR_AUTH0_DOMAIN}); ... auth0.refreshToken(refresh_token_here, (err, resp) => { // resp: {expires_in: 36000, id_token: "id_token here", token_type: "Bearer"} }
The same can be achieved with the getDelegationToken() function:
auth0.getDelegationToken({ client_id: YOUR_CLIENT_ID, grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer", refresh_token: refresh_token_here, scope: "openid", api_type: "auth0" }, (err, resp) => { // resp: {expires_in: 36000, id_token: "id_token here", token_type: "Bearer"} });
source share