Skip to content

Commit 19a85ac

Browse files
committed
fix: device_authorization w/ offline_access scope
1 parent ed1f77f commit 19a85ac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/actions/authorization/check_scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const instance = require('../../helpers/weak_cache');
77
*
88
* @throws: invalid_request
99
*/
10-
module.exports = provider => async function checkScope(ctx, next) {
10+
module.exports = (provider, PARAM_LIST) => async function checkScope(ctx, next) {
1111
const scopes = intersection(ctx.oidc.params.scope.split(' '), instance(provider).configuration('scopes'));
1212
const responseType = ctx.oidc.params.response_type;
1313
const { prompts } = ctx.oidc;
@@ -21,7 +21,7 @@ module.exports = provider => async function checkScope(ctx, next) {
2121
*/
2222

2323
if (scopes.includes('offline_access')) {
24-
if (!responseType.includes('code') || !prompts.includes('consent')) {
24+
if ((PARAM_LIST.has('response_type') && !responseType.includes('code')) || !prompts.includes('consent')) {
2525
pull(scopes, 'offline_access').join(' ');
2626
}
2727
}

lib/actions/authorization/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = function authorizationAction(provider, endpoint) {
8686
use(() => oidcRequired, A );
8787
use(() => checkPrompt(provider), A, DA );
8888
use(() => checkResponseType(provider), A );
89-
use(() => checkScope(provider), A, DA );
89+
use(() => checkScope(provider, whitelist), A, DA );
9090
use(() => checkRedirectUri, A );
9191
use(() => checkWebMessageUri(provider), A );
9292
use(() => checkPixy(provider), A, DA );

0 commit comments

Comments
 (0)