Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Allow to use refresh token on auth method (#134)
Browse files Browse the repository at this point in the history
* added methods for resources, permissions, scopes, policies

* Allow to use refresh token in auth method

Co-authored-by: Vinh Thieu <[email protected]>
  • Loading branch information
vinh-thieu and quangvinh2080 authored Jan 25, 2021
1 parent d926a3f commit e4077eb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Credentials {
clientSecret?: string;
totp?: string;
offlineToken?: boolean;
refreshToken?: string;
}

export interface Settings {
Expand Down Expand Up @@ -49,7 +50,12 @@ export const getToken = async (settings: Settings): Promise<TokenResponse> => {
client_id: credentials.clientId,
totp: credentials.totp,
...(credentials.offlineToken ? {scope: 'offline_access'} : {}),
...(credentials.refreshToken ? {
refresh_token: credentials.refreshToken,
client_secret: credentials.clientSecret,
} : {}),
});

const config: AxiosRequestConfig = {
...settings.requestConfig,
};
Expand Down

0 comments on commit e4077eb

Please sign in to comment.