我正在使用这些链接link1 , link2通过我的 Android 应用程序中的 linked 登录。我还在 linkedin 开发人员上创建了我的应用程序,并提供了 oauth 2.0 和 javascript 的链接。通过运行链接中的代码2:
final Activity thisActivity = this;
findViewById(R.id.btnLiSignIn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LISessionManager.getInstance(getApplicationContext()).init(thisActivity, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
// Authentication was successful. You can now do
// other calls with the SDK.
Log.d(TAG, "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString());
Toast.makeText(getApplicationContext(), "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onAuthError(LIAuthError error) {
// Handle authentication errors
Log.d(TAG, "failed " + error.toString());
Toast.makeText(getApplicationContext(), "failed " + error.toString(), Toast.LENGTH_LONG).show();
}
}, true);
}
});
我正在登录并获取访问 token 。我想向我的网站服务器发送访问 token 并从我的网站获取用户数据。当我发送此 token 时它不起作用。我需要获得其他 token 吗?请逐步指导。
最佳答案
你做不到。来自 documentation :
Mobile vs. server-side access tokens
It is important to note that access tokens that are acquired via the Mobile SDK are only useable with the Mobile SDK, and cannot be used to make server-side REST API calls.
Similarly, access tokens that you already have stored from your users that authenticated using a server-side REST API call will not work with the Mobile SDK.
而是在设备上获取所需信息并将信息发送到您的服务器。
关于android - 如何登录linkedin发送访问 token 到服务器端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34509529/