LinkedIn access token is null when using Android SDK
Asked Answered
C

1

7
  public void signInWithLinkedIn(View view){
        LISessionManager.getInstance(getApplicationContext()).init(this, buildScope(), new AuthListener() {
            @Override
            public void onAuthSuccess() {

                Toast.makeText(getApplicationContext(), "success" + LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().getValue(), Toast.LENGTH_LONG).show();
                Log.d("SESSION", Boolean.toString(LISessionManager.getInstance(getApplicationContext()).getSession().isValid()));
                //fetchBasicProfileData();
            }

            @Override
            public void onAuthError(LIAuthError error) {

                Toast.makeText(getApplicationContext(), "failed " + error.toString(),
                        Toast.LENGTH_LONG).show();
            }
        }, true);

        // After complete authentication start new HomePage Activity
    }

The block of code in onAuthSuccess got executed but getSession returns null AND most importantly the access token is null, making me unable to call other linkedin APIs. This happens only recently. Am I doing it correctly?

Updated:- One more thing it generally happens with few specific LinkedIn Ids and working fine with rest of the id.

Chickweed answered 16/1, 2019 at 17:25 Comment(1)
Any update on this ?Bestiality
R
3

LinkedIn is updating its android sdk and they deprecate several methods.They started doing this from this week, I also got the same problem.You should use javascript api's to authenticate user rather than using linkedin android sdk.We fixed ur problem the same way.

Romelda answered 16/1, 2019 at 17:50 Comment(2)
Hi, @Asad Please tell me, how to do that using javascript in detail.Bathilda
@ChetanKumarPatel currenly the project is close but you can get a help from this link developer.linkedin.com/docs/rest-apiRomelda

© 2022 - 2024 — McMap. All rights reserved.