web-function-sample icon indicating copy to clipboard operation
web-function-sample copied to clipboard

How to do a redirect using the reactive framework?

Open asarkar opened this issue 9 years ago • 0 comments

I'm playing with Instagram REST API and since they use OAuth, I need to redirect to their authorization URL. In regular Spring, that can be done by returning "redirect:" + authorizationUrl. Doing the following throws exception. See SPR-15078.

@GetMapping("/")
Mono<ServerResponse> redirect() {
        return ServerResponse.status(TEMPORARY_REDIRECT)
                .location(URI.create(authorizationUrl))
                .build();
}

asarkar avatar Jan 01 '17 02:01 asarkar