Jump to content

[SOLVED] Single Sign-On not detecting session


Ivo Pereira

Recommended Posts

Posted

Hello,

I have the following files:

/public_html/board/init.php
/public_html/external/controllers/TestController.php

To access the forums I use http://board.domain.com and to access TestController I do use http//external.domain.com/test

According to documentation:

If your external application is on the same domain or subdomain as your Community Suite and you can easily include the Community Suite PHP files, you can easily include the Community Suite framework and use the objects and methods made available to validate a user as being logged in.

In TestController, doing the following:

<?php

    /* [...] */

        require_once('../../board/init.php');

        \IPS\Session\Front::i();

        var_dump( \IPS\Member::loggedIn()->member_id );
        
?>

returns me false. It is able to execute the functions, however not able to return the logged in user info.

Any ideas of what could it be?

I guess I've found a similar issue, that I'm not aware if it was ever solved or not: https://community.invisionpower.com/topic/404331-get-user-information/

EDIT: After some testing I found out that I was able to get session if I create a simple demo.php file in the same directory as the board is located in. However, one folder up I am not able to get anything.

I've tried this solution, but it didn't worked so far (even after clearing cookies): https://community.invisionpower.com/4bugtrack/archived-reports/beta-7a-api-does-not-work-r2463/?do=findComment&comment=146173

EDIT2: Ahah, I've found it! Thanks to this reply: https://community.invisionpower.com/topic/405529-no-domain-cookie-in-ips4/?do=findComment&comment=2515120. Thank you @Mark!

Setting example.com to my main domain, solved it!

Nope. It sends without, which works better.

If you have a custom SSO setup which requires sending something different, it can be done by adding to constants.php:

define( 'COOKIE_DOMAIN', 'example.com' );

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...