gpt4 book ai didi

android - 如何登录 linkedin 向服务器端发送访问 token

转载 作者:行者123 更新时间:2023-11-29 15:08:25 32 4
gpt4 key购买 nike

我正在使用这些链接 link1 , link2通过我的 android 应用程序中的链接登录。我还在 linkedin 开发人员上创建了我的应用程序,还提供了 oauth 2.0 和 javascript 的链接。通过在 link2 中运行代码:

 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/

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