diff --git a/lib/context.js b/lib/context.js index 4bffb224..f05ca45b 100644 --- a/lib/context.js +++ b/lib/context.js @@ -160,10 +160,10 @@ class ResponseContext { return urlJoin(config.baseURL, config.routes.callback); } - silentLogin(options) { + silentLogin(options = {}) { return this.login({ ...options, - prompt: 'none', + authorizationParams: { ...options.authorizationParams, prompt: 'none' }, }); } diff --git a/test/attemptSilentLogin.tests.js b/test/attemptSilentLogin.tests.js index 1046ea75..ba6afa2d 100644 --- a/test/attemptSilentLogin.tests.js +++ b/test/attemptSilentLogin.tests.js @@ -1,3 +1,4 @@ +const { URL } = require('url'); const { assert } = require('chai'); const { create: createServer } = require('./fixture/server'); const { makeIdToken } = require('./fixture/cert'); @@ -50,6 +51,8 @@ describe('attemptSilentLogin', () => { const response = await request({ baseUrl, jar, url: '/protected' }); assert.equal(response.statusCode, 302); + const uri = new URL(response.headers.location); + assert.equal(uri.searchParams.get('prompt'), 'none'); assert.include(jar.getCookies(baseUrl)[0], { key: 'skipSilentLogin', value: 'true',