UNPKG

oidc-client-rx

Version:

ReactiveX enhanced OIDC and OAuth2 protocol support for browser-based JavaScript applications

17 lines (16 loc) 680 B
import { POSITIVE_VALIDATION_RESULT } from "../rule.js"; const useOfflineScopeWithSilentRenew = (passedConfig)=>{ const hasRefreshToken = passedConfig.useRefreshToken; const hasSilentRenew = passedConfig.silentRenew; const scope = passedConfig.scope || ''; const hasOfflineScope = scope.split(' ').includes('offline_access'); if (hasRefreshToken && hasSilentRenew && !hasOfflineScope) return { result: false, messages: [ 'When using silent renew and refresh tokens please set the `offline_access` scope' ], level: 'warning' }; return POSITIVE_VALIDATION_RESULT; }; export { useOfflineScopeWithSilentRenew };