I just noticed, that in handle method of oauth2controller, redirectUri is the one that was in request header, and not like in config.php. Is it as expected? I'm asking, because it makes problem, then I want to have my Flarum instance to be accessible on different URL, that is in config.php (I have a proxy server in between, and can't set preserveHost in Apache). When I changed this Uri for testing, it works with Url from config.php plus for example /auth/google.