Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Accessing user data from different site

Options
  • 15-03-2012 7:57pm
    #1
    Registered Users Posts: 338 ✭✭


    Hi,
    this is a tricky one but I basically need to access information about a user who is logged in on one site from a different site. i.e.:

    User 'Jack' is logged into domainA.com.
    domainA.com has stored in database that Jack's favourite colour is blue.

    Now is there some way to access this information from domainB.com. Basically finding out who is logged in to domainA.com. I could then create some kind of API to query what the user's favourite colour is, but first need to know from domainB.com who is logged into domainA.com. We own domainA.com. So it would be a case of putting some code on domainB.com to allow this.

    Logged in variable would probably be stored in a cookie.

    Any help appreciated. I am using PHP with MySQL by the way.


Comments

  • Registered Users Posts: 26,572 ✭✭✭✭Creamy Goodness


    domainA would need some sort of API to allow domainB to access domainA's database.

    or the hackier way to do it would be to authenticate through curl and scrape jack's info but that will be nasty and could break very easily if domainA changes their html at all.


  • Registered Users Posts: 2,781 ✭✭✭amen


    Webservice on DomainA which can be called from DomainB using the user name and passing back what you need.

    You might want to issues certs for the service, check the calling ip etc.

    Apart from the programming side do you own Domain B and even if you do does your user agreement/data protection policy (you do have one?) allow you to share this user information ?


  • Registered Users Posts: 342 ✭✭adm


    Store session data in database. Give second server access to database. done.
    Alternatively create a simple RESTful web service.


  • Registered Users Posts: 338 ✭✭jimmybeige


    Thanks for the replies. Very helpful.
    amen wrote: »
    Webservice on DomainA which can be called from DomainB using the user name and passing back what you need.

    You might want to issues certs for the service, check the calling ip etc.

    Apart from the programming side do you own Domain B and even if you do does your user agreement/data protection policy (you do have one?) allow you to share this user information ?

    No we don't own domainB. In fact it wouldn't be limited to one other domain. It would be multiple other domains that would need to check which user is currently logged in on our site, and send them information about that user. I guess similar to how facebook connect works, but a much more basic version.


Advertisement