mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
refactor: remove credentials cache
This commit is contained in:
parent
8513dae8af
commit
210bb298be
1 changed files with 1 additions and 7 deletions
|
@ -36,24 +36,18 @@ const accessTokenExpirationMargin = 60;
|
|||
export class CloudConnectionLibrary {
|
||||
private client?: Client<typeof router>;
|
||||
private accessTokenCache?: { expiresAt: number; accessToken: string };
|
||||
private credentialsCache?: CloudConnection;
|
||||
|
||||
constructor(private readonly logtoConfigs: LogtoConfigLibrary) {}
|
||||
|
||||
public getCloudConnectionData = async (): Promise<CloudConnection> => {
|
||||
if (this.credentialsCache) {
|
||||
return this.credentialsCache;
|
||||
}
|
||||
|
||||
const { getCloudConnectionData: getCloudServiceM2mCredentials } = this.logtoConfigs;
|
||||
const credentials = await getCloudServiceM2mCredentials();
|
||||
const { cloudUrlSet, adminUrlSet } = EnvSet.values;
|
||||
this.credentialsCache = {
|
||||
return {
|
||||
...credentials,
|
||||
tokenEndpoint: appendPath(adminUrlSet.endpoint, 'oidc/token').toString(),
|
||||
endpoint: appendPath(cloudUrlSet.endpoint, 'api').toString(),
|
||||
};
|
||||
return this.credentialsCache;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue