play-authenticate icon indicating copy to clipboard operation
play-authenticate copied to clipboard

How to redirect user to where he was after login via OAuth

Open nguyenlocduy opened this issue 10 years ago • 0 comments

I want to redirect user to the right page where he was before he press login (facebook or twitter). I can get the referer from context and redirect user like this

Http.Context ctx = Http.Context.current();
String returnUrl = ctx.request().getHeader("referer");
return redirect(returnUrl);

but this does not work for 1st time signup user in which he will be redirected to Facebook and has to accept the permissions dialog. Then the referer returned is 'null' so it will redirect to /null which is not right. The acceptance should be the exact page where he was before he click login (with facebook or twitter). Any ideas is greatly appreciated.

nguyenlocduy avatar Nov 28 '13 15:11 nguyenlocduy