Skip to content

Commit

Permalink
Fix jwt error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sukso96100 committed Aug 3, 2023
1 parent 4acc37f commit 07187cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 21 additions & 3 deletions lib/kioskclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class KioskClient {
}

dynamic verifyQrToken(String token) {
final jwt = JWT.verify(token, ECPublicKey(jwtKey));
var pubkey = ECPublicKey(jwtKey);
final jwt =
JWT.verify(token, pubkey, checkExpiresIn: false, checkNotBefore: false);
return jwt.payload;
}

Expand Down Expand Up @@ -76,7 +78,9 @@ class KioskClient {
payload['nametagUrl'],
payload['sub']);
return (true, payload);
} on JWTExpiredException catch (e) {
} on JWTExpiredException catch (e, s) {
print(e);
print(s);
return (
false,
{
Expand All @@ -86,7 +90,21 @@ class KioskClient {
"nametagUrl": ""
}
);
} on JWTException catch (e) {
} on JWTException catch (e, s) {
print(e);
print(s);
return (
false,
{
"nametagName": "[X]",
"nametagAffiliation": "",
"nametagRole": "QR 코드 처리 오류.",
"nametagUrl": ""
}
);
} catch (e, s) {
print(e);
print(s);
return (
false,
{
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ class _KioskMainPageState extends State<KioskMainPage> {
await kioskClient.checkInOnServer(qrContent);
}
}
} catch (e) {
} catch (e, s) {
print(e);
print(s);
}
}
}
Expand Down

0 comments on commit 07187cf

Please sign in to comment.