Class: CognitoRails::JWT
- Inherits:
-
Object
- Object
- CognitoRails::JWT
- Defined in:
- lib/cognito_rails/jwt.rb
Class Method Summary collapse
Class Method Details
.decode(token) ⇒ Array<Hash>?
12 13 14 15 16 17 18 19 20 |
# File 'lib/cognito_rails/jwt.rb', line 12 def decode(token) aws_idp = with_cache { URI.open(jwks_url).read } jwt_config = JSON.parse(aws_idp, symbolize_names: true) ::JWT.decode(token, nil, true, { jwks: jwt_config, algorithms: ['RS256'] }) rescue ::JWT::ExpiredSignature, ::JWT::VerificationError, ::JWT::DecodeError => e Config.logger&.error e. nil end |