tharuka ok, so here is the issue. I'll look at that. Keep an eye on the tracker to get updated when I'll solve it: https://tracker.maicol07.it/issue/FSSOE-19
PHP and WordPress Single Sign On (SSO) with optional JWT Addon
tharuka I didn't mean that. The $flarum->redirect() method only redirects the user to Flarum root. What I say is within the extension. The middleware runs on every request to Flarum. So if the user clicks a link to a discussion in your Flarum (i.e. from google) then the login middleware runs. If user is signed in in your auth system then it will be logged in and page is refresh (Redirect to the same page). Writing the forum url overrides this refresh and redirects to Flarum root
Is there any way I could use Google OAuth with this plugin? I tried setting up Google Social Login with a WP plugin but it doesn't seem to login into Flarum.
- Edited
Hi @maicol07
Sorry to bother you a lot.
My folder structure is like this
www
->sso
-->forum
------>public
------>vendor
-->vendor
-->index.php
-->flarum.php
-->delete.php
->.......
index.php for login in inside the sso folder and forum folder is also at the same place
localhost/sso to load login page and localhost/sso/forum/public is the forum url.
I used these parameters as follows
FLARUM_HOST=http://localhost/sso/forum/public
API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ROOT_DOMAIN=localhost
Can you point out anything wrong with this configuration? I used the given example login forms with your php library. Still I can't figure out this problem. It always redirects me to localhost intsed of forum public url which I redirected using header("Location: http://localhost/sso/forum/public"); after logging in
maicol07 When I echo Done at LoginMiddleware I get an output like below
Done
( ! ) Fatal error: Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Output has been emitted previously; cannot emit response in C:\wamp64\www\sso\forum\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php on line 24
( ! ) Laminas\HttpHandlerRunner\Exception\EmitterException: Output has been emitted previously; cannot emit response in C:\wamp64\www\sso\forum\vendor\laminas\laminas-httphandlerrunner\src\Exception\EmitterException.php on line 24
Call Stack
Time Memory Function Location
1 0.0001 363392 {main}( ) ...\index.php:0
2 0.0027 387304 Flarum\Http\Server->listen( ) ...\index.php:26
3 0.0822 3048680 Laminas\HttpHandlerRunner\RequestHandlerRunner->run( ) ...\Server.php:44
4 0.1072 3877880 Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit( ) ...\RequestHandlerRunner.php:98
5 0.1072 3877880 Laminas\HttpHandlerRunner\Emitter\SapiEmitter->assertNoPreviousOutput( ) ...\SapiEmitter.php:27
this line 24 is the echo line which I put. It is getting redirected at the LoginMiddleware. This only happens when a user logged in for the first time after logging out.
- Edited
maicol07 this dumps http://localhost/ as the echo output and after login in always it redirects to localhost root in login middleware in this return return new RedirectResponse($request->getUri()).
So sorry about wasting your valuable time.
What about the reverse, flarum on root and various separate wp installs on different subfolders?