title: Firebase Custom Auth Error: The custom token format is incorrect
body: <p>I am generating token using JJWT library like this - </p>
  
  <pre><code>    final String issuer = "my-app-auth-server@my-app-797ab.iam.gserviceaccount.com";
      final String sub = "my-app-auth-server@my-app-797ab.iam.gserviceaccount.com";
      final String aud = "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit";
      final String secret = "my-secret-key"   //only demo key , not real secret key that i am using
  
  
  
      final long iat = System.currentTimeMillis() / 1000L; // issued at claim
      final long exp = iat + 60L; // expires claim. In this case the token expires in 60 seconds
  
      final String jwtString = Jwts.builder()
                  .claim("alg","HS256")
                  .claim("iss", issuer)
                  .claim("aud",aud)
                  .claim("iat", iat)
                  .claim("exp", exp)
                  .claim("uid",number)
                  .setSubject(sub)
                  .signWith(SignatureAlgorithm.HS256, secret)
                  .compact();
  </code></pre>
  
  <p>The secret key("my-secret-key") i am using is generated by Firebase , as stated <a href="https://firebase.google.com/docs/server/setup#add_firebase_to_your_app" rel="nofollow noreferrer">here</a></p>
  
  <p>But i am getting this error when i am signing in Firebase with the token generated as above - </p>
  
  <pre><code>com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The custom token format is incorrect. Please check the documentation.
                                                                           at com.google.android.gms.internal.zzafd.zzes(Unknown Source)
                                                                           at com.google.android.gms.internal.zzafa$zzg.zza(Unknown Source)
                                                                           at com.google.android.gms.internal.zzafl.zzet(Unknown Source)
                                                                           at com.google.android.gms.internal.zzafl$zza.onFailure(Unknown Source)
                                                                           at com.google.android.gms.internal.zzafg$zza.onTransact(Unknown Source)
                                                                           at android.os.Binder.execTransact(Binder.java:367)
                                                                           at dalvik.system.NativeStart.run(Native Method)
  </code></pre>
  
  <p>This is how it looks decoded - </p>
  
  <p><a href="https://i.stack.imgur.com/Zti5y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zti5y.png" alt="enter image description here"></a></p>
  
  <p>Please help , Thanks in advance.</p>