zendesk / sunshine-conversations-ruby

Smooch API Library for Ruby
Apache License 2.0
14 stars 16 forks source link

Forbiden Request Issue When Create an Apps #10

Closed rahmatullah5 closed 7 years ago

rahmatullah5 commented 7 years ago

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

rahmatullah5 commented 7 years ago

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

ghantoos commented 7 years ago

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!