Module: SolidusJwt::Decodeable

Included in:
SolidusJwt
Defined in:
lib/solidus_jwt/concerns/decodeable.rb

Instance Method Summary collapse

Instance Method Details

#decode(token) ⇒ Array<Hash>

Decode a token generated by SolidusJwt

Examples:

decode a token.

SolidusJwt.decode('abc.123.efg')
#=> [{"sub"=>"1234567890", "name"=>"John Doe", "iat"=>1516239022}, {"alg"=>"HS256", "typ"=>"JWT"}]

Parameters:

  • token (String)

    The token to decode

Returns:

  • (Array<Hash>)

See Also:



16
17
18
19
# File 'lib/solidus_jwt/concerns/decodeable.rb', line 16

def decode(token)
  JWT.decode(token, SolidusJwt::Config.jwt_secret, true,
    algorithm: SolidusJwt::Config.jwt_algorithm)
end