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

标签 android authentication oauth-2.0 linkedin-api

我正在使用这些链接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/

相关文章:

javascript - localStorage中的JWT仅在刷新页面后才起作用

oauth - 在 Chrome 扩展程序和 Gmail 小工具中安全处理 OAuth 使用者 key 和 secret

oauth-2.0 - 如何实现 OAuth 2.0 授权服务器?

ios - 在 iOS 上没有登录的 OAuth 2.0?

php - PHP Intranet 可以共享 Windows 登录名吗?

java - HttpClient只会执行一次Android

java - 为什么我在运行 IOIO Mint 应用程序时得到 "libcore.io.ErrnoException: open failed: ENOENT"?

authentication - access_type = Online 什么时候合适? :OAuth2 - Google API

安卓 : Capture a document & Scan it using camera

android - Google Goggles - Android 应用程序