mirror of
https://github.com/outline/outline.git
synced 2026-11-29 16:40:27 +03:00
fix: Add explicit error for missing auth token
This commit is contained in:
1 parent
42f9971368
commit
dd4c8c5546
1 file changed
+4
-1
+4
-1
@@ -5,6 +5,9 @@ import { AuthenticationError } from "../errors";
|
||||
|
||||
export function getJWTPayload(token: string) {
|
||||
let payload;
|
||||
if (!token) {
|
||||
throw AuthenticationError("Missing token");
|
||||
}
|
||||
|
||||
try {
|
||||
payload = JWT.decode(token);
|
||||
@@ -15,7 +18,7 @@ export function getJWTPayload(token: string) {
|
||||
|
||||
return payload as JWT.JwtPayload;
|
||||
} catch (err) {
|
||||
throw AuthenticationError("Unable to decode JWT token");
|
||||
throw AuthenticationError("Unable to decode token");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user