Open NickPaul41 opened 4 months ago
The example code for getting a JsonWebToken does not seem to work. firebase-admin
JsonWebToken
@Path("/app") public class FirebaseAppResource { @Inject FirebaseApp firebaseApp; @Inject SecurityIdentity identity; @GET @Path("/options") @Produces(MediaType.APPLICATION_JSON) public FirebaseOptions getOptions() { if(identity instanceof JsonWebToken) { System.out.println("JWT: " + ((JsonWebToken) identity).getClaim("email")); } return firebaseApp.getOptions(); } }
When debugging my project identity is not an instanceof JsonWebToken.
I'm able to do a workaround by casting identity.getPrincipal() to a FirebasePrincipal.
identity.getPrincipal()
FirebasePrincipal
@GET @Produces(MediaType.APPLICATION_JSON) public FirebaseOptions getOptions() { FirebasePrincipal fbp; if(identity.getPrincipal() instanceof FirebasePrincipal) { fbp = (FirebasePrincipal) identity.getPrincipal(); System.out.println("FirebasePrincipal: " + fbp.getClaim("email")); } return firebaseApp.getOptions(); }
Is this an issue with the documentation or should identity be an instance of JsonWebToken?
The example code for getting a
JsonWebToken
does not seem to work. firebase-adminWhen debugging my project identity is not an instanceof
JsonWebToken
.I'm able to do a workaround by casting
identity.getPrincipal()
to aFirebasePrincipal
.Is this an issue with the documentation or should identity be an instance of
JsonWebToken
?