1.2.5 • Published 6 years ago
cross-fetch-with-token v1.2.5
Install
npm install --save cross-fetch-with-token
Usage
With promises:
import fetch, { settings } from 'cross-fetch-with-token';
settings.urlToken = 'https://yourdomain.com/api/connect/token/';
settings.clientData = {
clientId: 'clientId',
clientSecret: 'clientSecret',
grantType: 'client_credentials'
};
fetch('url').then(res => {
return res.json();
}).then(res => {
console.log(res);
}).catch(err => {
console.error(err);
});
Settings
Option | Type | Default |
---|---|---|
urlToken | string | / |
storeKeyToken | string | MY.APP.token |
expiresToken | nubmer | 86400ms (1 day) |
clientData | object | {} |
Author
Stas Raranetskyi |