Can I ping the API to search for a user by their IP address?

I’d like to be able to match visitors that come into our website with their forum profiles. One common thread I’ve found between a web visitor’s info and a forum user’s info is IP address.

Even better would be if you could match them on their auth token or cookie, but IP can do for now.

EDIT: I suppose a workaround would be to query the whole list of users, save that object, then search by IP through the that.

EDIT2: Now I’m seeing active.json doesn’t include IP, but the .csv export does?

So they aren’t logged in to your website with the same authentication system as Discourse? That’s how you’d usually solve this problem. Then you’d have their username and so on.

@pfaffman Maybe that’s how I’d do it too, but it looks like the cookies between company.com and forum.company.com aren’t shared, for example.

You almost certainly want to use SSO so that both sites are using the same user database. That actually solves your problem, where your IP solution works only if you’re lucky.

2 Likes