Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

buildProviderConfig lets an undefined option overwrite the preset (e.g. scope from onResolveProvider)

Aperta Adatta ai principianti
#243 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Inizia da buildProviderConfig in src/lib/config.ts, quindi confronta il suo comportamento con l'output compilato in dist/lib/config.js e con la gestione di scope indicata in dist/lib/OAuthProvider.js. Aggiungi il test unitario richiesto per una configurazione Google risolta con scope: undefined e verifica che il preset conservi 'openid profile email', mentre i valori espliciti null o stringa vuota rimangano distinguibili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happens

buildProviderConfig (src/lib/config.ts) copies every key of the caller's provider options into expandedOptions, including keys whose value is undefined, then builds the config as { ...pluginDefaults, ...providerPreset, ...expandedOptions, redirectUri }. An option present with value undefined therefore overwrites the preset's value.

The common trigger is a dynamic provider from onResolveProvider: a hook that returns a config object built from a database row naturally writes scope: row.scope, which is undefined when the row has no custom scope. For the Google preset that replaces 'openid profile email' with undefined, OAuthProvider then sends scope: this.config.scope || '', and Google rejects the authorization request (an empty scope). The same shape can clear any preset default (usernameClaim, issuer, jwksUri, …) that a hook passes through unset.

Verified by reading the 2.7.0 build (dist/lib/config.js ~L205-L262, dist/lib/OAuthProvider.js ~L59); found through a consumer whose resolver returns scope: config.scope for every org provider.

Expected

An option whose value is undefined means "not specified" and must not override the plugin default or the preset. Skip undefined values when building expandedOptions (keep null/'' as explicit values if that's the intended contract, and document it), with a unit test: a Google config resolved with scope: undefined ends up with 'openid profile email'.

Lingua principale
JavaScript
Stelle
1
Fork
2
Merge medio
3g 8h
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di HarperFast/oauth

Tutte le issue di HarperFast/oauth

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.