Determine from a external PHP App if a Grav user is logged in

Hi,
I want to integrate an existing PHP App into Grav, without writing a Plugin.
Therefore I need to access the current user’s name and if he authenticated successfully with Grav.

Is there a way to get this data from an external PHP App?

In e.g. Joomla, it is possible to launch a minimal core instance and get the authenticated user with

$user =& JFactory::getUser();

Any similar procedure here ?

Thank you very much,
Harald

I solved this by writing a Plugin, which sends its own auth cookie on login and deletes it on logout. External apps can now check the presence of the cookie and verify its auth code to determine, if a user is logged in.

Grav’s flexibility just rocks :slight_smile:

2 Likes

Fantastic! Yes there’s nothing to fear about writing a plugin. I didn’t follow exactly what you were doing here, but please consider releasing your plugin openly if you think it can be useful to others :slight_smile:

I will release it after excessive testing :slight_smile:

1 Like

@hschneider I like the promise of ‘excessive testing’ before releasing code to the community… :+1:

1 Like