Skip to content

Commit

Permalink
fix: use client_credentials as grant_type for token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviostutz committed Jan 24, 2025
1 parent 2bfdea1 commit d72dd1e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/src/wso2/wso2-utils.ts
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ export const prepareAxiosForWso2Calls = async (wso2Config: Wso2Config): Promise<
client.interceptors.request.use((config: any) => {
// eslint-disable-next-line no-param-reassign
config.metadata = { startTime: new Date().getTime() };
console.log(`> REQUEST: ${config.method?.toUpperCase()} ${wso2Config.baseApiUrl}${config.url}`);
console.log(`> REQUEST: ${config.method?.toUpperCase()} ${config.baseURL}${config.url}`);
console.log(
JSON.stringify({
baseURL: config.baseURL,
@@ -141,7 +141,7 @@ export const registerClient = async (config: Wso2ApimConfig): Promise<ClientCred
const data = {
clientName: config.clientName ?? 'wso2apim-sdk-client',
owner: config.owner ?? config.username,
grantType: 'password refresh_token',
grantType: 'password refresh_token client_credentials',
saasApp: true,
};

@@ -178,9 +178,7 @@ export const getBearerToken = async (

const data = qs.stringify({
// eslint-disable-next-line camelcase
grant_type: 'password',
username: config.username,
password: config.password,
grant_type: 'client_credentials',
scope: `${scopesPublisher} ${scopesStore}`,
});

0 comments on commit d72dd1e

Please sign in to comment.