I am trying to write the integration test cases One of the tests need to send X-auth firebase header
How to generate the Firebase auth token in Java?
I am trying to write the integration test cases One of the tests need to send X-auth firebase header
How to generate the Firebase auth token in Java?
You can use the Firebase Admin SDK for Java to generate a Firebase Authentication token.
In its simplest form, generating the token looks like this:
String uid = "some-uid";
String customToken = FirebaseAuth.getInstance().createCustomToken(uid);
You can also set specific claims in the token, with something like this:
String uid = "some-uid";
Map<String, Object> additionalClaims = new HashMap<String, Object>();
additionalClaims.put("premiumAccount", true);
String customToken = FirebaseAuth.getInstance()
.createCustomToken(uid, additionalClaims);
Both examples come straight from the documentation I linked, so I highly recommend checking that out for more details.