Issue a new access token based on previously issued refresh token for OAuth 2.0 compatible providers. Client authentication can be provided directly as input, or, if supported, set as provider parameter.
npx @superfaceai/cli install oauth2/refresh-token
const { SuperfaceClient } = require('@superfaceai/one-sdk');
const sdk = new SuperfaceClient();
async function run() {
// Load the installed profile
const profile = await sdk.getProfile('oauth2/refresh-token');
// Use the profile
const result = await profile
.getUseCase('GetAccessTokenFromRefreshToken')
.perform({
refreshToken: '',
clientId: '',
clientSecret: ''
});
return result.unwrap();
}
run();
Switching providers Learn how to use automatic failover or switch between providers manually.
Missing your favorite provider? Tell us which provider you'd like to use.