Jump to content

Cookie for chat application


inkredible

Recommended Posts

Hello,

I would like to write an own chat application using an external node.js server. For this purpose I want to "authenticate" users serversided. I thought it would be the best to send the user's cookie along with the initial connection. I am not experienced with the IPB framework though and hence I wonder how I can get the user's cookie and how I can decrypt the cookie on my node.js server.

 

Also: Is there a documentation about all existent IPB classes? All what I have found until now are forum posts about the existent IPB classes and it's members.

 

Best regards,

Inkredible.

Link to comment
Share on other sites

The cookies will be member_id and pass_hash, and then you can compare this against the values stored for the member.

				$member = \IPS\Member::load( (int) \IPS\Request::i()->cookie['member_id'] );
				if ( $member->member_login_key AND \IPS\Request::i()->cookie['pass_hash'] AND \IPS\Login::compareHashes( (string) $member->member_login_key, (string) \IPS\Request::i()->cookie['pass_hash'] ) )
				{
					// Member is valid
				}

 

Link to comment
Share on other sites

1 hour ago, bfarber said:

The cookies will be member_id and pass_hash, and then you can compare this against the values stored for the member.


				$member = \IPS\Member::load( (int) \IPS\Request::i()->cookie['member_id'] );
				if ( $member->member_login_key AND \IPS\Request::i()->cookie['pass_hash'] AND \IPS\Login::compareHashes( (string) $member->member_login_key, (string) \IPS\Request::i()->cookie['pass_hash'] ) )
				{
					// Member is valid
				}

 

Thanks for the snippet.

Can you also answer my second question regarding the documentation of all IPB classes and it's members?

Link to comment
Share on other sites

2 hours ago, bfarber said:

I'm afraid there's no phpdoc printout at this time unfortunately.

What should I do in order to find specific members / classes? I am not very familiar with large php projects, so maybe I am not aware of a possiblity to inform myself about the classes.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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