| 335 | } |
| 336 | |
| 337 | #getAccessToken() { |
| 338 | // Get the access token from Frontegg's context holder |
| 339 | const accessToken = ContextHolder.for("default").getAccessToken(); |
| 340 | |
| 341 | // The token will most likely always exist since this function |
| 342 | // will be called when logged in. If not, we should alert Sentry. |
| 343 | if (!accessToken) { |
| 344 | Sentry.addBreadcrumb({ |
| 345 | level: "error", |
| 346 | category: "auth", |
| 347 | message: "Failed to refresh auth token", |
| 348 | }); |
| 349 | } |
| 350 | return accessToken; |
| 351 | } |
| 352 | |
| 353 | #authMiddleware: Middleware = (next) => { |
| 354 | return async (...fetchArgs) => { |