facebook-android-sdk icon indicating copy to clipboard operation
facebook-android-sdk copied to clipboard

Facebook Login - Obtain null Authentication token

Open DRPrincess opened this issue 3 years ago • 11 comments

Checklist before submitting a bug report

Java version

java 11.0.12

Android version

Andriod 11

Android SDK version

8.2.0

Installation platform & version

implementation 'com.facebook.android:facebook-android-sdk:latest.release'

Package

Login

Goals

have an jwt format token

Expected results

have an jwt format token

Actual results

authenticationToken is empty

Steps to reproduce

No response

Code samples & details

val fBLoginManager = com.facebook.login.LoginManager.getInstance()
            fBLoginManager.registerCallback(mFaceBookCallbackManager, object : FacebookCallback<LoginResult> {

                override fun onCancel() {
                    Log.i(TAG, "facebook: onCancel")
               
                }

                override fun onError(error: FacebookException) {
                    Log.i(TAG, "facebook: error$error")
                   
                }


                override fun onSuccess(result: LoginResult) {
                    Log.i(TAG, "facebook: onSuccess")
                    //not empty
                    val accessToken = result.accessToken
                    //empty
                    val authenticationToken = result.authenticationToken
                   
               }
                    
            })
            fBLoginManager.logInWithReadPermissions(mFragment.fragment, mFaceBookCallbackManager, listOf("email", "public_profile"))

DRPrincess avatar Nov 07 '22 06:11 DRPrincess

I have the same issue. LoginResult returns the correct accessToken, but the authenticationToken (JWT token) is always null. Seems like a bug in the SDK. Is it possible that this will be fixed soon?

sonjaBrzak avatar Jan 12 '23 13:01 sonjaBrzak

@sonjaBrzak because no documentation provided for Android ,so I understand facebook android sdk is not support OIDC ,I solve my question by google firrbase ,it can help have a JWT token。

DRPrincess avatar Jan 13 '23 01:01 DRPrincess

@DRPrincess you are right, Firebase can help you get the JWT, although the issuer of that token will be google, not facebook, which could be a problem for the validation part of the token on the backend side. Did you solve that issue somehow?

sonjaBrzak avatar Jan 19 '23 15:01 sonjaBrzak

I have the same issue.

ViktorAkselrod avatar Jun 26 '23 21:06 ViktorAkselrod

Do we have any progress or information on this issue? This exact code works perfectly on iOS with iOS facebook SDK, but for android I always get null on the AuthenticationToken.getCurrentAuthenticationToken - same for loginResult.authenticationToken.

This is blocking my team from adding facebook login to the app I'm working on.

Micpol avatar Aug 11 '23 10:08 Micpol

@KylinChang @carolineli @mingcaozhang

Please fix retrieval of JWT token. This issue is ongoing from version 8.0.0 up until latest (at the time of writing 16.0.0)!

It can't be that the same functionality is working on iOS SDK, but not on Android and no documentation about this exists!

Why Android SDK is being ignored?

codefluencer avatar Aug 17 '23 12:08 codefluencer

same problem here. Please fix.

avlaev avatar Nov 02 '23 08:11 avlaev

Same issue here. Does Meta have any official workaround guidance? Is it expected that we implement the flow manually (https://developers.facebook.com/docs/facebook-login/guides/advanced/oidc-token)?

DougSig avatar Nov 15 '23 17:11 DougSig