From 63ce5607e950b25563a8bb4249bbf8e3a6abb538 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Sat, 9 Nov 2019 16:04:02 +0530 Subject: [PATCH] [Bug] Rescue error on JWT.encode (#201) --- app/controllers/widgets_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/widgets_controller.rb b/app/controllers/widgets_controller.rb index 979186c59..6fac657bb 100644 --- a/app/controllers/widgets_controller.rb +++ b/app/controllers/widgets_controller.rb @@ -43,9 +43,13 @@ class WidgetsController < ActionController::Base return @cookie_params if @cookie_params.present? if conversation_token.present? - @cookie_params = JWT.decode( - conversation_token, secret_key, true, algorithm: 'HS256' - ).first.symbolize_keys + begin + @cookie_params = JWT.decode( + conversation_token, secret_key, true, algorithm: 'HS256' + ).first.symbolize_keys + rescue StandardError + @cookie_params = {} + end return @cookie_params end {}