I have a Spring Boot server which performs the entire OAuth 2.0 Authorisation flow by using Google as an auth provider. I use the Spring OAuth library which already has filters for OAuth endpoints for providers like Google and Facebook.
I have a React front end which kicks this flow off by opening a new window with a URL that points to the Google authorisation endpoint on my server when a user clicks login.
When the server has successfully authenticated a user and retrieved a JWT token from Google, I need to pass this back to my React front end and store the token so that the user can then use it to make authorised requests to my backend API.
As far as I understand I cannot get my front end to send a GET request to my backend for the token as the OAuth Authorisation flow works using redirects. Otherwise I could have returned the JWT to my front end in the body of a HTTP response as described here: https://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html#ExAccTokResp
My alternative then is to redirect to a front end 'login success' page from the server on a successful authorisation attempt by appending the JWT token as a URL parameter which my front end will then parse and store. Exposing the JWT as a URL parameter doesn't seem safe however, is there a better/more secure way I can redirect back to my client with a JWT token from my server?