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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

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

Solved by Harald Schneider View solution

Started by Harald Schneider 6 years ago · 4 replies · 633 views
6 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
6 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
6 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 :)

6 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 Thomas, 1 week ago
2 60 16 hours ago
Support · by Anna, 3 days ago
2 66 19 hours ago
Support · by Justin Young, 20 hours ago
1 34 20 hours ago
Support · by Duc , 1 week ago
2 70 6 days ago
Support · by Colin Hume, 1 week ago
2 61 6 days ago