ruby on rails - "Access to posting shares denied" error when posting public messages using the linkedin api -
i trying send out messages using linkedin ruby api api end point : http://api.linkedin.com/v1/people/~/shares, everytime error : linkedin::errors::accessdeniederror ((403): access posting shares denied). wrong?
code:
#fetch client object client = linkedin::client.new('er0xev11ktyj', 'qw7hfgr4wt8hztpl') #auth request_token = client.request_token(:oauth_callback => callback_url) session[:linkedin_token] = request_token.token session[:linkedin_secret] = request_token.secret redirect_to request_token.authorize_url #inside callback url atoken,asecret = client.authorize_from_request(session[:linkedin_token], session[:linkedin_secret], params[:oauth_verifier]) #api phone call posting message client.authorize_from_access(atoken, asecret) client.add_share({:comment => "hey!"}) #throws error! do need specify scope parameters? if yes, how implement in code?
thanks
override default consumer options , append scope request_token_path
consumer_options = { :request_token_path => "/uas/oauth/requesttoken?scope=r_basicprofile+w_share", :access_token_path => "/uas/oauth/accesstoken", :authorize_path => "/uas/oauth/authorize", :api_host => "https://api.linkedin.com", :auth_host => "https://www.linkedin.com" } linkedin::client.new(ckey, csecret, consumer_options) ruby-on-rails ruby linkedin
No comments:
Post a Comment