Verifying Token Using Firebase Admin SDK In .net - Exeption: 'Incorrect Number Of Segments In $ID Token.'

I'm building a Web.API to send notifications to iOS application via Firebase. I have integrated the Firebase admin SDK in .net project. As per the, I implemented the below code. However I get an error when I call "VerifyIdTokenAsync". The error is "Incorrect number of segments in $ID token."

 var defaultApp = FirebaseApp.Create(new AppOptions()
                Credential = GoogleCredential.FromFile(strFilePath),

            // Retrieve services by passing the defaultApp variable...
            var defaultAuth = FirebaseAuth.GetAuth(defaultApp);

            FirebasVerifyIdTokenAsynceToken decodedToken = await defaultAuth.(deviceToken);
            string uid = decodedToken.Uid;

I checked several post and documentation online but all refer to the same code with no much further troubleshooting information. Please help.



An ID token (which is a type of JWT) must have exactly 3 segments, separated by periods: header.body.signature. The above error message is saying that the string you're passing as the ID token has some other number of segments. So your input string is not an ID token at all.