LinkedIn REST API 身份验证突然停止工作 Android 模拟器
LinkedIn REST API authentication suddenly stopped working Android Emulator
我正在使用 LinkedIn REST API 获取用户的 linkedIn 详细信息,它一直工作到今天(过去 1 个月)。我正在获取基本详细信息,例如姓名电子邮件 only.Even 它一直工作到今天玩了一半突然报错,
Caused by: com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.linkedin.com/uas/oauth/requestToken
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:180)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:45)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:14)
at android.os.AsyncTask.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.linkedin.com/uas/oauth/requestToken
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:172)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:45)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:14)
at android.os.AsyncTask.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.io.FileNotFoundException: https://api.linkedin.com/uas/oauth/requestToken
这是代码,
public class LinkedInAsyncTask extends AsyncTask<String, Void, Void> {
LinkedInActivity mContext;
public static LinkedInApiClientFactory factory;
public static LinkedInOAuthService oAuthService;
public static LinkedInRequestToken liToken;
public static final String LINKEDIN_CONSUMER_KEY = "XXXXXXX";//gave like this for security purpose only.
public static final String LINKEDIN_CONSUMER_SECRET = "XXXXXXX";
public static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin";
public static final String OAUTH_CALLBACK_HOST = "callback";
// public static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;
public static String OAUTH_CALLBACK_URL = "x-oauthflow-linkedin://callback";
public LinkedInAsyncTask(LinkedInActivity mContext) {
this.mContext = mContext;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(String... params) {
LinkedinDialog.oAuthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(LINKEDIN_CONSUMER_KEY, LINKEDIN_CONSUMER_SECRET);
LinkedinDialog.factory = LinkedInApiClientFactory.newInstance(LINKEDIN_CONSUMER_KEY, LINKEDIN_CONSUMER_SECRET);
LinkedinDialog.liToken = LinkedinDialog.oAuthService.getOAuthRequestToken(OAUTH_CALLBACK_URL);
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
mContext.setWebView();
}
}
求推荐。
我找到了解决方案!,问题是因为我是模拟器上的 运行(它打开了很长时间),来自模拟器的时间数据与 linkedIn 服务器不匹配,即使是很短的时间也会拒绝请求differences.Hence,唯一的解决办法是关闭并重新启动 emulator.Hope,这对某人有帮助。
我正在使用 LinkedIn REST API 获取用户的 linkedIn 详细信息,它一直工作到今天(过去 1 个月)。我正在获取基本详细信息,例如姓名电子邮件 only.Even 它一直工作到今天玩了一半突然报错,
Caused by: com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.linkedin.com/uas/oauth/requestToken
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:180)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:45)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:14)
at android.os.AsyncTask.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.linkedin.com/uas/oauth/requestToken
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:172)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:45)
at in.techchefs.talktemple.login.LinkedInAsyncTask.doInBackground(LinkedInAsyncTask.java:14)
at android.os.AsyncTask.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.io.FileNotFoundException: https://api.linkedin.com/uas/oauth/requestToken
这是代码,
public class LinkedInAsyncTask extends AsyncTask<String, Void, Void> {
LinkedInActivity mContext;
public static LinkedInApiClientFactory factory;
public static LinkedInOAuthService oAuthService;
public static LinkedInRequestToken liToken;
public static final String LINKEDIN_CONSUMER_KEY = "XXXXXXX";//gave like this for security purpose only.
public static final String LINKEDIN_CONSUMER_SECRET = "XXXXXXX";
public static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin";
public static final String OAUTH_CALLBACK_HOST = "callback";
// public static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;
public static String OAUTH_CALLBACK_URL = "x-oauthflow-linkedin://callback";
public LinkedInAsyncTask(LinkedInActivity mContext) {
this.mContext = mContext;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(String... params) {
LinkedinDialog.oAuthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(LINKEDIN_CONSUMER_KEY, LINKEDIN_CONSUMER_SECRET);
LinkedinDialog.factory = LinkedInApiClientFactory.newInstance(LINKEDIN_CONSUMER_KEY, LINKEDIN_CONSUMER_SECRET);
LinkedinDialog.liToken = LinkedinDialog.oAuthService.getOAuthRequestToken(OAUTH_CALLBACK_URL);
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
mContext.setWebView();
}
}
求推荐。
我找到了解决方案!,问题是因为我是模拟器上的 运行(它打开了很长时间),来自模拟器的时间数据与 linkedIn 服务器不匹配,即使是很短的时间也会拒绝请求differences.Hence,唯一的解决办法是关闭并重新启动 emulator.Hope,这对某人有帮助。