gpt4 book ai didi

android - 领英通讯失败

转载 作者:太空宇宙 更新时间:2023-11-03 13:04:22 25 4
gpt4 key购买 nike

final LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerKeyValue, consumerSecretValue);   
LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken();

我正在使用 LinkedApi 库,昨天这段代码可以正常工作,但今天我不知道为什么,但它给出了异常

LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken();

它的给予:

com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.linkedin.com/uas/oauth/requestToken

最佳答案

--已解决--我贴出代码,希望各位小伙伴不要纠结

第 1 步)使用 API 获取密码

oauthService= LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerKeyValue, consumerSecretValue);   
requestToken= oauthService.getOAuthRequestToken();
//requestToken=oauthService.getOAuthRequestToken();
//getOAuthRequestToken("");
autoToken= requestToken.getToken();
authoTokenSecret = requestToken.getTokenSecret();
authUrl= requestToken.getAuthorizationUrl();
Log.i("Tok", autoToken);
Log.i("Tok", authoTokenSecret);
Log.i("Tok", authUrl);

webview.loadUrl(authUrl);

第 2 步)webview 将在登录后显示 pin 现在使用您的 pin 获取访问 token 并使用访问 token 获取个人资料和更新状态

String pin = pin_edit.getText().toString();
System.out.println("Fetching access token from LinkedIn...");
LinkedInAccessToken accessToken = oauthService.getOAuthAccessToken(requestToken, pin);
System.out.println("Access token: " + accessToken.getToken());
System.out.println("Token secret: " + accessToken.getTokenSecret());
final LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(consumerKeyValue, consumerSecretValue);
final LinkedInApiClient client = factory.createLinkedInApiClient(accessToken);

Person profile = client.getProfileForCurrentUser();
profile.setCurrentStatus("Hello all my friends ,I am missing you all");
client.updateCurrentStatus("Hello all going");

关于android - 领英通讯失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6965298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com