Class: Warden::JWTAuth::TokenDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/warden/jwt_auth/token_decoder.rb

Overview

Decodes a JWT into a hash payload into a JWT token

Instance Method Summary collapse

Instance Method Details

#call(token) ⇒ Hash

Decodes the payload from a JWT as a hash

token is invalid

Parameters:

  • token (String)

    a JWT

Returns:

  • (Hash)

    payload decoded from the JWT

See Also:

  • for all the exceptions than can be raised when given


16
17
18
19
20
21
22
# File 'lib/warden/jwt_auth/token_decoder.rb', line 16

def call(token)
  JWT.decode(token,
             secret,
             true,
             algorithm: algorithm,
             verify_jti: true)[0]
end