fix(server): token revokation checks for format (bearer xxx)
This commit is contained in:
@@ -21,7 +21,12 @@ module.exports = {
|
||||
return await createPersonalAccessToken( context.userId, args.token.name, args.token.scopes, args.token.lifespan )
|
||||
},
|
||||
async apiTokenRevoke( parent, args, context, info ) {
|
||||
await revokeToken( args.token.split( ' ' )[ 1 ], context.userId ) // let's not revoke other people's tokens
|
||||
let id = null
|
||||
if ( args.token.toLowerCase().includes( "bearer" ) )
|
||||
id = args.token.split( ' ' )[ 1 ]
|
||||
else
|
||||
id = args.token
|
||||
await revokeToken( id, context.userId ) // let's not revoke other people's tokens
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user