setAuthorization method

void setAuthorization(
  1. DescopeSessionManager sessionManager
)

Ensures that the active session in a DescopeSessionManager is valid and then sets its session JWT as the Bearer Token value of the Authorization header field in the http.Request.

Implementation

void setAuthorization(DescopeSessionManager sessionManager) async {
  await sessionManager.refreshSessionIfNeeded();
  final session = sessionManager.session;
  if (session != null) {
    setAuthorizationFromSession(session);
  }
}