From 67e00c3de618833ad25b7975e2fcca072ebba43d Mon Sep 17 00:00:00 2001 From: okrad Date: Mon, 13 Dec 2021 23:33:26 +0100 Subject: [PATCH] Fix for #64? --- lib/src/token_storage.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/token_storage.dart b/lib/src/token_storage.dart index ec48128..c7a58d2 100644 --- a/lib/src/token_storage.dart +++ b/lib/src/token_storage.dart @@ -38,12 +38,14 @@ class TokenStorage { found = (tkn['scope'] == null || tkn['scope'].isEmpty); } else { //...Otherwise look for a token granted to a superset of the requested scopes - final tknCleanScopes = clearScopes(tkn['scope'].cast()); - - if (tknCleanScopes.isNotEmpty) { - var s1 = Set.from(tknCleanScopes); - var s2 = Set.from(cleanScopes); - found = s1.intersection(s2).length == cleanScopes.length; + if (tkn.containsKey('scope')) { + final tknCleanScopes = clearScopes(tkn['scope'].cast()); + + if (tknCleanScopes.isNotEmpty) { + var s1 = Set.from(tknCleanScopes); + var s2 = Set.from(cleanScopes); + found = s1.intersection(s2).length == cleanScopes.length; + } } }