Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

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 · 845 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 complanar, 6 days ago
6 137 12 hours ago
Support · by Rick Beebe, 6 days ago
2 99 2 days ago
Support · by blu3prince, 3 days ago
0 50 3 days ago
Support · by alex, 4 days ago
2 91 3 days ago
Support · by Marcel, 2 weeks ago
1 142 3 days ago