{"id":3571,"date":"2014-03-28T11:01:54","date_gmt":"2014-03-28T11:01:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/oauth-2-0linkedinrauthrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-03-28T11:01:54","modified_gmt":"2014-03-28T11:01:54","slug":"oauth-2-0linkedinrauthrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/oauth-2-0linkedinrauthrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"oauth-2.0,linkedin,rauthRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/64839d31baaefafa58120e1a5a503d66?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohn Conde<br \/>\noauth-2.0 google-openid<br \/>\nFor your reference, i have been doing the background reading and learning using the following linksUsing oAuth2 Google API Developer Guide Understanding oAuth 2.0As i didnt have much success with the Google API code samples, i used the following library as an oAuth 2.0 Librarygo2.jsHowever, i am struggling to understand what is it that i am supposed to provide to the go2.getToken command in terms of callback variable. Additionally, i used the following code to do a test POST to the Calendar and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/aad37b5f7116c8d1f547d23b37566032?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ngdonald<br \/>\nandroid google-api oauth-2.0<br \/>\nHow can I validate the auth_token returned fromtoken = bundle.getString(AccountManager.KEY_AUTHTOKEN);?After I get the new user on Android I need to insert them into my database server side, but I need to validate that token somehow before I do.I am trying to use the token like this:url = &#8216;https:\/\/www.googleapis.com\/oauth2\/v1\/userinfo?access_token=%s&#8217; % access_tokenbut Google is returning &#8216;Unauthorized Access&#8217;.How can I access https:\/\/www.googleapis.com\/oauth2\/v1\/userinfousing the Android Accoun<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a17751c04b0f9c08da1c777559dfccb2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRemy<br \/>\nc# api oauth-2.0 versionone<br \/>\nI am able to do queries using OAuth2 and this: \/rest-1.oauth.v1\/Data\/Story?sel=Name,Number&amp;Accept=text\/jsonHowever I am unable to get the OAuth2 and the new query1.v1 to work against the Sumnmer2013 VersionOne. I am getting (401) Unauthorized and specified method is not supported using two different URLs.Here is the code that includes the working \/rest-1.oauth.v1 and the non-working query1.v1 and non-working query.legacy.v1. Scroll towards the bottom of the code to see the Program Main (s<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a3c6ce6aad74e51bfaa87dc5ba3f1477?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\naskvictor<br \/>\npython oauth-2.0 gdata gdata-api google-data-api<br \/>\nI&#8217;ve worked out how OAuth2 works (via https:\/\/developers.google.com\/api-client-library\/python\/guide\/aaa_oauth) and now have an OAuth2Credentials object (let&#8217;s call the object credentials) that I want to use for Google Apps provisioning purposes (the example here is using sites, but could be any of the gdata apis)If I try:client = gdata.sites.client.SitesClient(site=&#8221;test-site&#8221;,domain=&#8217;my.domain&#8217;) client = credentials.authorize(client)I get TypeError: new_request() got an unexpected keyword argum<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7012ce54f5b02c8741ae73cec596b7fc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\n???? ????????<br \/>\nruby-on-rails ruby oauth-2.0 omniauth fitbit<br \/>\nI&#8217;m trying to set up omniauth with the fitbit api.I created a file in config\/initializers\/omniauth.rb:Rails.application.config.middleware.use OmniAuth::Builder doprovider :fitbit, b4aaad9b1 , 88bd74511f#NOT THE ACTUAL KEYS &#8211; I deleted middle numbers to preserve formatting endwhen I run:rails sI receive the errorgems\/ruby-1.9.3-p448@rails3tutorial2ndEd\/gems\/activesupport-3.2.3\/lib\/active_support\/dependencies.rb:245:in `load&#8217;: config\/initializers\/omniauth.rb:3: syntax error, unexpected tIDENTIFIER<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100000596242180\/picture?type=large\" \/><br \/>\nFrank Provost<br \/>\njavascript oauth-2.0 linkedin linkedin-jsapi<br \/>\nI already got the authorization code from the Linked In Api, but I cannot get the Access Token, because it always says: Origin http:\/\/ is not allowed by Access-Control-Allow-Origin.This is my request:$.ajax({ type: &#8220;POST&#8221;, url: linked_url, data: { grant_type: &#8220;authorization_code&#8221;,code: res[0], redirect_uri: re_uri, client_id: c_id, client_secret: cs_id},dataType: &#8220;json&#8221; });I already tried this:var jsonp = $.getJSON(&#8220;&#8221; + linked_url + &#8220;&amp;callback=?&#8221;);By this I get the error: Uncaught SyntaxErro<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/863e24c91fcf1cd3c879ea62a401365e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSamnang<br \/>\nruby-on-rails api oauth-2.0 doorkeeper<br \/>\nI&#8217;m using Doorkeeper with rails-api to implement oAuth2 with password workflow:resource_owner_from_credentials doFacebookAuthorization.create(params[:username]) endRight now when exception occurs it displays 500 template html response from rails. What I want to do is rescue any unexpected exception, then I want to custom the response error message base on exception that occurred in json response.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/25d9997eec9f3d1625be2f245cff29b8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPseudoNinja<br \/>\nphp oauth-2.0 linkedin<br \/>\nAttempting to integrate Single Sign On into the project I am working on. URL for Authentication is:https:\/\/www.linkedin.com\/uas\/oauth2\/authorization?response_type=code&amp;client_id=#####&amp;scope=r_basicprofile%2C+r_contactinfo%2C+r_emailaddress&amp;state=527ac1ed0f8081.42856052&amp;redirect_uri=http%3A%2F%2F###.####.co%2Fsignin%2FlinkedinRedirects to: http:\/\/www.linkedin.com\/nhome\/?report%2Efailure=adZIVBnWTib4up_BiP_fhajxJtMf-QxCuI5n3xXRttZscKxS6FJjbN4qYCKWmvPauF8bvrjY0gMo-bRRTAHLnrfYYkKD-qa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0db19cfa9cbf8e539ec7f2b90a2cb7d3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMhsmith21<br \/>\nruby-on-rails-3 oauth-2.0 client fitbit<br \/>\nI&#8217;m trying to let my user make GET requests to the Fitbit API. Currently the user has all of their tokens, but I&#8217;m struggling to create a client. User_controller.rbdef show @user = User.find(params[:id]) if (@user.device != nil)p &#8220;PRINTING DEVICES&#8221;p @user.device@device = @user.device@client = Fitgem::Client.new(:consumer_key =&gt; &#8216;b4aacb5c2c8c43e2a6873877cd2ad9b1&#8242;,:consumer_secret =&gt; &#8217;88bd78fc86d84d6c9aa7b1c0b8d4511f&#8217;,:token =&gt; @device.oauth_token,:secret =&gt; @device.oauth_token_secret)<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7e6e0e2b73358e47e0b7f83f8111f75b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMattDiPasquale<br \/>\nobjective-c twitter-oauth oauth-2.0<br \/>\nOn his blog post about LROAuth2Client &#8211; OAuth2 for iPhone and iPad applications, Luke Redpath states:If possible, you should try and obtain the end-user and token URIs at runtime rather than hardcoding them into your application. This can be typically done by making an unauthorised request to a secure URI and obtaining them from the WWW-Authenticate header in the returned 401 response.Please provide example code of how this is done in order to implement Sign in with Twitter on iOS.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5bb892a6fbb381f4427e4209f96c253c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPau<br \/>\napi linkedin zoho<br \/>\nI am Zoho Creator developer.I want share comment in linkedin by zoho creator.I can use post or get instruction only.I have code, auth_token, &#8230; but I can&#8217;t share comment in linkedinI tried it:headermap= map(); headermap.put(&#8220;Content-Type:&#8221;, &#8220;application\/xml&#8221;); headermap.put(&#8220;Content-Length:&#8221;,cadena2.length());contentmap = map(); cadena2 = &#8220;&lt;?xml version=\\&#8221;1.0\\&#8221; encoding=\\&#8221;UTF-8\\&#8221;?&gt; \\n&#8221;; cadena2 = cadena2 + &#8221; &lt;share&gt; \\n&#8221;; cadena2 = cadena2 + &#8221; &lt;comment&gt;Pruebas&lt;\/comme<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/717b95bd686b89f7aedaf6b5d8bf849a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPeter J Harrison<br \/>\nphp api oauth linkedin<br \/>\nI need someones help with the LinkedIn API.I&#8217;m currently setting requestToken, oath_verifier and oauth_access_token from the session once the I accept the connection. This all works fine but obviously when the session ends I have to approve the app again to see my data.32. $linkedin-&gt;request_token = unserialize($_SESSION[&#8216;requestToken&#8217;]); 33. $linkedin-&gt;oauth_verifier = $_SESSION[&#8216;oauth_verifier&#8217;]; 34. $linkedin-&gt;access_token = unserialize($_SESSION[&#8216;oauth_access_token&#8217;])<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/eddc5c2a929371fc3145172dadf96456?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2500094<br \/>\nc# asp.net linkedin<br \/>\nI&#8217;m trying to add post comment in LinkedIn for the past one weekI&#8217;ve written this codeprotected void Page_Load(object sender, EventArgs e){string xmlContent = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;&#8221;;xmlContent += &#8220;&lt;comment&gt;&lt;text&gt;Check out&lt;\/text&gt;&lt;\/comment&gt;&#8221;;byte[] databytes = Encoding.Default.GetBytes(xmlContent);var credentials = new Hammock.Authentication.OAuth.OAuthCredentials{Type = OAuthType.AccessToken,SignatureMethod = OAuthSignatureMethod.HmacSha1,ParameterH<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f2da289c120aa46e679476d36a0b803b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDHN<br \/>\nc# linkedin restsharp hammock<br \/>\nI could get all the posts and comments from LinkedIn but I am unable to add post commentI tried with Hammock and RestSharp library still I get an error Could not parse message document or Unexpected file end nullorUnauthentication scheme`This is my codeprotected void Page_Load(object sender, EventArgs e) {string xmlContent = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;&#8221; + Environment.NewLine +&#8221;&lt;comment&gt;&#8221; + Environment.NewLine +&#8221;&lt;text&gt;Check out&lt;\/text&gt;&#8221; + Environment.NewLine +&#8221;&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d42f9f903279df2c1c9596ccef07065d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJim Steil<br \/>\npython linkedin rauth<br \/>\nI have recently taken over support for an app that uses rauth to connect to linkedin. The code that is failing is:self.linkedin= OAuth1Service( name=&#8217;linkedin&#8217;, consumer_key=self._consumer_key, consumer_secret=self._consumer_secret, request_token_url=self.request_token_url, access_token_url=self.acces<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2a88f6eafe5736a2856b0f02aae061ab?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nTomer Z<br \/>\noauth linkedin<br \/>\nI&#8217;m trying to authorize my iPhone app using the linkedin api but I keep getting errors in the authorization phase. I copied the URL from the app and tried to see how it act on my browser (chrome) and I get an error over there too. The URL is: https:\/\/www.linkedin.com\/uas\/oauth2\/authorization?response_type=code%20&amp;client_id=\/myClientId\/%20&amp;scope=r_fullprofile%20r_emailaddress%20&amp;state=\/stateString\/&amp;redirect_uri=http%3A%2F%2Fwww%2Egoogle%2Ecomin my browser I get to the main page of<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/LcwMn.png?s=32&amp;g=1\" \/><br \/>\nPaul Osetinsky<br \/>\nruby-on-rails linkedin<br \/>\nquick question: i&#8217;m using the linkedin gem to pull user data, but my app breaks if a particular data field is blank on the user&#8217;s linkedin profile. is there an optimal way to scan each profile for blankness in all data fields and pull only those that are present to prevent breaking?here is my auth_controller&#8230;i know it is not DRY and in need of refactoring. Thanks!require &#8216;linkedin&#8217;class AuthController &lt; ApplicationControllerdef indexclient = LinkedIn::Client.new(ENV[&#8216;LINKEDIN_KEY&#8217;], ENV[&#8216;LI<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e5e3382f7220865dca37c187b7dd7b4f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAntipod<br \/>\nlinkedin addthis<br \/>\nWhen I try to share my page with AddThis to Linkedin it is working fine from desktop, but even the same URL is not working when I do just the same from iPhone.To test it:Open AddThis home page and click share to LinkedIn button. As a result I have http:\/\/www.linkedin.com\/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.addthis.com%2F%23.Tt3z80Hs1Wo.linkedin&amp;title=AddThis+-+Share+Button%2C+Social+Bookmark%2C+Sharing+Plugins+and+Module&amp;ro=false&amp;summary=&amp;source= opened in my browser,<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1960a1a40295b3057f6ed54e36f175f9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPaul0515<br \/>\nlinkedin restsharp<br \/>\nI&#8217;m having difficculty getting a share working on linkedin using restsharp. Here&#8217;s my code:var shareMsg = new{comment = &#8220;Testing out the LinkedIn Share API with JSON&#8221;,content = new{title = &#8220;Test post to LinkedIn&#8221;,submitted_url = &#8220;http:\/\/www.somewebsite.com&#8221;,submitted_image_url = &#8220;http:\/\/www.somewebsite.com\/image.png&#8221;},visibility = new{code = &#8220;anyone&#8221;}};RestClient rc = new RestClient(LinkedInAppInfo.LinkedInBaseApiUrl);RestRequest request = new RestRequest(LinkedInAppInfo.SharePostPath, Method.PO<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b02d69f3dd9e6f32457cbe7c8e694e69?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPaul Mennega<br \/>\napi linkedin<br \/>\nI have placed the simple linkedin class on my server and added my api keys etc, however when i call the demo page i get the following error:Parse error: syntax error, unexpected T_FUNCTION in \/home\/mycv\/public_html\/dev\/linkedin_3.2.0.class.php on line 259this is the code for the area around line: 259if(is_array($http_code_required)) {array_walk($http_code_required, function($value, $key) {if(!is_int($value)) {throw new LinkedInException(&#8216;LinkedIn-&gt;checkResponse(): $http_code_required must b<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d42f9f903279df2c1c9596ccef07065d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJim Steil<br \/>\npython linkedin rauth<br \/>\nI have recently taken over support for an app that uses rauth to connect to linkedin. The code that is failing is:self.linkedin= OAuth1Service( name=&#8217;linkedin&#8217;, consumer_key=self._consumer_key, consumer_secret=self._consumer_secret, request_token_url=self.request_token_url, access_token_url=self.acces<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b683040b04cc96d7f4a674cd9cf05bed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nt_-_t<br \/>\noauth-2.0 linkedin rauth<br \/>\nI am trying to connect to LinkedIn using the OAuth2Service provided by rauth. I successfully retrieve the access token. To do so, I configured a specific decoder for the json response.json_decoder = json.loads params = {&#8216;decoder&#8217;: json_decoder} session = linkedin.get_auth_session(data=data, **params)But when doing the API call via r = session.get(&#8216;people\/~&#8217;, data={&#8220;x-li-format&#8221;:&#8217;json&#8217;},) the following response is coming back:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243; standalone=&#8221;yes&#8221;?&gt; &lt;erro<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>John Conde oauth-2.0 google-openid For your reference, i have been doing the background reading and learning using the following linksUsing oAuth2 Google API Developer Guide Understanding oAuth 2.0As i didnt have much success with the Google API code samples, i used the following library as an oAuth 2.0 Librarygo2.jsHowever, i am struggling to understand what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3571","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3571"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3571\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}