Could not navigate to error after external redirect

In my Vaadin 24 / Spring Boot application, I have a @RestController that receives an OAuth2 Response when authenticating with Google.

The method is annotated with

@RequestMapping(value = { "/gmail-authenticate" }, method = RequestMethod.GET)

The method signature is:

public void authenticate( HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String redirectUrl ) throws Exception

I have a similar method that works fine. However, after Google redirects to http://localhost:8080/gmail-authenticate?xxx I get the Vaadin error

Could not navigate to 'gmail-authenticate'

If I copy the URL and open it in a new tab, it opens correctly.

I have tried changing the Controller to a HttpServlet instead, but the same issue happens.

You have to exclude the URL, so that Vaadin does not tries to handle it cause of the /* handling - see the docs: Configuration | Spring | Integrations | Vaadin Docs.

Thank you. I have tried both




The same issue occurs with the error message 'Could not navigate to 'gmail-authenticate'

Reloading the same tab shows the same error - copying and pasting the URL into a new tab works.

Could there be a service worker🤔 Do you happen to have @PWA annotation in that app?

Thanks, Matti.

I did previously disable the @PWA Annotation - but looking at Dev Tools, there were still some service workers registered. I removed them and all now seems to be working!

If I did want to re-enable @PWA - is there a known workaround for this issue?

Thanks again!

Nice👍 Service workers are such a PITA (during development). Even if one has had it on previously in another project, it may cause weird issues…

I don’t know by heart if the autogenerated service worker (by the @PWA annotation) respects the configuration, but if it don’t, I’d claim it is a bug. A workaround would be be to override/hand write the service worker. Not handy (as JS is involved :nerd_face:), but doable if needed.

1 Like

Thanks for all the help - much appreciated!

1 Like