(
scopes: Scope[] = ["notesnook.sync", "IdentityServerApi"],
forceRenew = false
)
| 93 | } |
| 94 | |
| 95 | async getAccessToken( |
| 96 | scopes: Scope[] = ["notesnook.sync", "IdentityServerApi"], |
| 97 | forceRenew = false |
| 98 | ) { |
| 99 | return await getSafeToken( |
| 100 | async () => { |
| 101 | const token = await this.getToken(true, forceRenew); |
| 102 | if (!token || !token.scope) return; |
| 103 | if (!scopes.some((s) => token.scope.includes(s))) return; |
| 104 | return token.access_token; |
| 105 | }, |
| 106 | "Error getting access token:", |
| 107 | this.eventManager |
| 108 | ); |
| 109 | } |
| 110 | |
| 111 | async _refreshToken(forceRenew = false) { |
| 112 | await this.REFRESH_TOKEN_MUTEX.runExclusive(async () => { |
no test coverage detected