-
Notifications
You must be signed in to change notification settings - Fork 375
Closed
Labels
Milestone
Description
This (example code taken fro the github page) throws an Audience Error:
hmac_secret = 'test'
aud = ['Young', 'Old']
aud_payload = { :data => 'data', :aud => aud }
token = JWT.encode aud_payload, hmac_secret, 'HS256'
begin
# Add aud to the validation to check if the token has been manipulated
decoded_token = JWT.decode token, hmac_secret, true, { :aud => aud, :verify_aud => true, :algorithm => 'HS256' }
rescue JWT::InvalidAudError
# Handle invalid token, e.g. logout user or deny access
puts 'Audience Error'
end