How to use the @authx/scopes.getDifference function in @authx/scopes

To help you get started, we’ve selected a few @authx/scopes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / packages / interface / src / client / Authorize.tsx View on Github external
const grantedScopesExplanations = useMemo(
    () =>
      explanations && grantedScopes
        ? match(explanations, grantedScopes, {
            currentAuthorizationId: null,
            currentGrantId: grantId,
            currentUserId: userId,
            currentClientId: clientId
          })
        : [],
    [explanations, grantedScopes, clientId, grantId, userId]
  );

  const newRequestedScopes =
    grant && grant.scopes
      ? getDifference(
          grant.scopes.filter(s => overrides[s] !== false),
          requestedScopes
        )
      : requestedScopes;

  const newRequestedScopesExplanations = useMemo(
    () =>
      explanations
        ? match(explanations, newRequestedScopes, {
            currentAuthorizationId: null,
            currentGrantId: grantId,
            currentUserId: userId,
            currentClientId: clientId
          })
        : [],
    [explanations, newRequestedScopes, clientId, grantId, userId]

@authx/scopes

This is a small collection of utility functions for AuthX scopes. These scopes are human-readable, fully OAuth2-compatible, and support both pattern matching and set algebra.

MIT
Latest version published 7 months ago

Package Health Score

69 / 100
Full package analysis