()
| 12 | } |
| 13 | |
| 14 | async getAccessToken() { |
| 15 | const api_scope = 'api://' + import.meta.env.IQENGINE_APP_ID + '/api'; |
| 16 | if (!this.account) return null; |
| 17 | try { |
| 18 | const response = await this.instance.acquireTokenSilent({ |
| 19 | account: this.account, |
| 20 | scopes: [api_scope], |
| 21 | }); |
| 22 | return response.accessToken; |
| 23 | } catch (error) { |
| 24 | return null; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | async requestWithAuthIfRequired(config: AxiosRequestConfig) { |
| 29 | const token = await this.getAccessToken(); |
no outgoing calls
no test coverage detected