Open benjaminstammen opened 1 year ago
Thanks for your feedback. I just updated the spring boot API to read from either the cookie or the authorization header.
You can view the java code here: https://github.com/FusionAuth/fusionauth-quickstart-java-springboot-api/blob/main/complete-application/src/main/java/io/fusionauth/quickstart/springapi/SecurityConfiguration.java
I created a custom BearerTokenResolver. I did it inline for ease of implementation, but you could definitely pull it out to another class for reuse.
Let me know if that addresses your concerns, @benjaminstammen .
Using Spring Boot and ReactJs together is pretty common, so I think a lot of people coming to this repository might be looking to integrate the two.
The React SDK provided by FusionAuth sets HttpOnly cookies that are automatically submitted per-request, which may work well for other server libraries, but unless I'm mistaken, parsing a JWT from a cookie in Spring is a fairly manual process and grates against the "happy path" of using an Authorization header.
It would be great if there were sample code available for this integration, or for it to be called out in the tutorial / readme (happy to contribute). Because I'm new at Javascript and decent with Kotlin, I've opted to just make to with the HttpOnly cookie while using the React SDK as is (my attempt below).