digital-payments-sdk
Version:
The APIs detailed within this SDK will enable Shell's Fleet Solutions Customers to digitalize Shell Card/s and use them to pay to refuel their vehicles at Shell Stations.
43 lines • 2.3 kB
JavaScript
/**
* Shell SmartPay APILib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { accessTokenResponseSchema, } from '../models/accessTokenResponse';
import { string } from '../schema';
import { BaseController } from './baseController';
import { AccessTokenError } from '../errors/accessTokenError';
export class ShellAPIPlatformSecurityAuthenticationController extends BaseController {
/**
* To obtain APIGEE access token
*
* @param grantType In OAuth 2.0, the term grant typee refers to the way an application gets an access
* token. OAuth 2.0 defines several grant types, including the authorization code flow.
* @param clientId After registering your app, you will receive a client ID and a client secret. The
* client ID is considered public information, and is used to build login URLs, or
* included in Javascript source code on a page.
* @param clientSecret After registering your app, you will receive a client ID and a client secret. The
* client ID is considered public information, and is used to build login URLs, or
* included in Javascript source code on a page. The client secret must be kept
* confidential.
* @return Response from the API call
*/
async oauthTokenPost(grantType, clientId, clientSecret, requestOptions) {
const req = this.createRequest('POST', '/oauth/token');
const mapped = req.prepareArgs({
grantType: [grantType, string()],
clientId: [clientId, string()],
clientSecret: [clientSecret, string()],
});
req.header('Content-Type', 'application/x-www-form-urlencoded');
req.form({
grant_type: mapped.grantType,
client_id: mapped.clientId,
client_secret: mapped.clientSecret,
});
req.throwOn(401, AccessTokenError, 'Unauthorized');
req.authenticate([]);
return req.callAsJson(accessTokenResponseSchema, requestOptions);
}
}
//# sourceMappingURL=shellAPIPlatformSecurityAuthenticationController.js.map