zendesk / sunshine-conversations-ruby

Smooch API Library for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forbiden Request Issue When Create an Apps

rahmatullah5 opened this issue · comments

Hi , when i am request to create an apps using , i am geeting this error

ETHON: Libcurl initialized
ETHON: performed EASY effective_url=https://api.smooch.io/v1/apps response_code=403 return_code=ok total_time=1.8884370000000001
SmoochApi::ApiError: Forbidden

from /Users/fourtyonestudio/.rvm/gems/ruby-2.4.1/gems/smooch-api-2.0.0/lib/smooch-api/api_client.rb:65:in `call_api'

Here is my request script

api_instance = SmoochApi::AppApi.new
app_create_body = SmoochApi::AppCreate.new
begin
result = api_instance.create_app(app_create_body)
@Alert = result
rescue SmoochApi::ApiError => e
@Alert = "Exception when calling AppApi->create_app: #{e}"
end

and my config file

require 'jwt'
require 'smooch-api'

payload = {:scope => 'app'}
jwtHeader = {:kid => ENV['SMOOCH_KEY']}
token = JWT.encode payload, ENV['SMOOCH_SECRET'], 'HS256', jwtHeader

SmoochApi.configure do |config|
config.api_key['Authorization'] = token
config.api_key_prefix['Authorization'] = 'Bearer'
end

my environtment variable
SMOOCH_KEY=XXXXXXXX
SMOOCH_SECRET=ZZZZZZZZZZ

my credential key

actually i found the solution , change the :scope to account

Hi @rahmatullah5,

Your initial comment has been edited to remove your private information.

This is a public repository and issue. Please do not share any personal KEY or SECRET.

Thanks!