Open GoogleCodeExporter opened 9 years ago
once check consumer key and consumer secret keys properly
Original comment by kres...@gmail.com
on 29 Aug 2012 at 10:42
I'm using the right keys and secret. Actually I'm able to update the status of
the profile but the above exception comes only when I'm trying to post some
network updates.
Original comment by narendra...@gmail.com
on 29 Aug 2012 at 11:07
I proposed these two changes to the implementation to solve the problems
encountered with scope...
1.
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html>LinkedInOAuthService.java (Today 18.48.21)</html>
+++ <html>LinkedInOAuthService.java (Today 18.54.32)</html>
@@ -51,6 +51,15 @@
*
* @return the o auth access token
*/
+ public LinkedInAccessToken getOAuthAccessToken(LinkedInRequestToken
requestToken, String scope, String oauthVerifier);
+ /**
+ * Gets the o auth access token.
+ *
+ * @param requestToken the request token
+ * @param oauthVerifier the oauthVerifier
+ *
+ * @return the o auth access token
+ */
public LinkedInAccessToken getOAuthAccessToken(LinkedInRequestToken requestToken, String oauthVerifier);
/**
2.
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html>LinkedInOAuthServiceImpl.java (Today 18.48.21)</html>
+++ <html>LinkedInOAuthServiceImpl.java (Today 18.59.30)</html>
@@ -115,12 +115,20 @@
*/
@Override
public LinkedInAccessToken getOAuthAccessToken(LinkedInRequestToken requestToken, String oauthVerifier) {
+ return(getOAuthAccessToken(requestToken, null, oauthVerifier));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public LinkedInAccessToken getOAuthAccessToken(LinkedInRequestToken
requestToken, String scope, String oauthVerifier) {
if (requestToken == null) {
throw new IllegalArgumentException("request token cannot be null.");
}
try {
final OAuthConsumer consumer = getOAuthConsumer();
- final OAuthProvider provider = getOAuthProvider();
+ final OAuthProvider provider = getOAuthProvider(scope);
consumer.setTokenWithSecret(requestToken.getToken(), requestToken.getTokenSecret());
provider.retrieveAccessToken(consumer, oauthVerifier);
@@ -227,7 +235,13 @@
*
*/
protected OAuthProvider getOAuthProvider() {
- DefaultOAuthProvider provider = new
DefaultOAuthProvider(LinkedInApiUrls.LINKED_IN_OAUTH_REQUEST_TOKEN_URL,
+ return(getOAuthProvider(null));
+ }
+ /**
+ *
+ */
+ protected OAuthProvider getOAuthProvider(String scope) {
+ DefaultOAuthProvider provider = new
DefaultOAuthProvider(LinkedInApiUrls.LINKED_IN_OAUTH_REQUEST_TOKEN_URL+(scope!=n
ull)?"?scope="+scope.replace(' ', '+'):"",
LinkedInApiUrls.LINKED_IN_OAUTH_ACCESS_TOKEN_URL, LinkedInApiUrls.LINKED_IN_OAUTH_AUTHORIZE_URL);
provider.setOAuth10a(OAUTH_VERSION_1_0_a.equals(ApplicationConstants.OAUTH_VERSION));
Then use instead of simply:
LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(linkedInApiKey, linkedInSecretKey)
LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken(callbackUrl);
LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(linkedInApiKey, linkedInSecretKey)
LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken(callbackUrl, scope);
The scope is defined with a string like (See
http://oodlestechnologies.com/blogs/Recent-changes-in-LinkedIn-API for more
info)
scope = "r_fullprofile r_network";
Hopes it helps
Thierry Bodhuin
Original comment by bodh...@gmail.com
on 15 Sep 2012 at 5:12
hi i am using java now how to use scope ...for linkedin
Original comment by prash...@cloudcodes.com
on 28 Sep 2012 at 8:32
Original issue reported on code.google.com by
narendra...@gmail.com
on 24 Aug 2012 at 10:39