Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

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

Solved by Harald Schneider View solution

Started by Harald Schneider 7 years ago · 4 replies · 798 views
7 years ago

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

👍 1
7 years ago Solution

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 :-)

👍 2
7 years ago

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 :)

7 years ago

@hschneider I like the promise of 'excessive testing' before releasing code to the community... 👍

👍 2

Suggested topics

Topic Participants Replies Views Activity
Support · by Paul Hodges, 4 weeks ago
19 483 5 days ago
Support · by Lauw, 7 days ago
2 99 6 days ago
Support · by Anna, 3 weeks ago
4 426 1 week ago
Support · by gtx, 4 weeks ago
4 377 3 weeks ago
Support · by Anna, 1 month ago
9 484 3 weeks ago