File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,18 @@ import BaseError from '../utils/baseError';
22
33export default class AuthError extends BaseError {
44 constructor ( response ) {
5- const { status, json = { } , text } = response ;
6- const { error, error_description : description } = json ;
5+ const { status, json = { } , text} = response ;
6+ const { error, error_description : description } = json ;
77 super (
88 error || 'a0.response.invalid' ,
9- description || text || 'unknown error'
9+ description || text || handleInvalidToken ( response ) || 'unknown error' ,
1010 ) ;
1111 this . json = json ;
1212 this . status = status ;
1313 }
1414}
15+
16+ const handleInvalidToken = response =>
17+ response ?. headers ?. map [ 'www-authenticate' ] . match ( / e r r o r = " i n v a l i d _ t o k e n " / g)
18+ ? 'invalid_token'
19+ : null ;
You can’t perform that action at this time.
0 commit comments