Add generation of the Canny SSO token

This commit is contained in:
Andreas Nedbal 2022-01-22 07:39:33 +01:00 committed by Andreas Nedbal
parent 4d4296de19
commit 7374aba6d3
5 changed files with 20 additions and 0 deletions

View File

@ -64,6 +64,8 @@ gem "redis"
gem "fake_email_validator"
gem "jwt", "~> 2.3"
group :development do
gem "binding_of_caller"
gem "byebug"

View File

@ -291,6 +291,7 @@ GEM
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.6.1)
jwt (2.3.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
@ -639,6 +640,7 @@ DEPENDENCIES
httparty
i18n-js (= 3.6)
jbuilder (~> 2.10)
jwt (~> 2.3)
letter_opener
mini_magick
omniauth

View File

@ -0,0 +1,14 @@
module FeedbackHelper
def canny_token
return if current_user.nil?
userData = {
avatarURL: current_user.profile_picture.url(:large),
name: current_user.screen_name,
id: current_user.id,
email: current_user.email
}
JWT.encode(userData, APP_CONFIG.dig("canny", "sso"))
end
end

View File

@ -6,5 +6,6 @@
%script
Canny('render', {
boardToken: '#{APP_CONFIG['canny']['bug_board']}',
ssoToken: '#{canny_token}',
basePath: '/feedback/bugs'
});

View File

@ -6,5 +6,6 @@
%script
Canny('render', {
boardToken: '#{APP_CONFIG['canny']['feature_board']}',
ssoToken: '#{canny_token}',
basePath: '/feedback/feature-requests'
});