In the . Net application, create a button, for example, where the user will click to access the PHP application on the other server.
By clicking this button, a token is generated (unique encrypted key).
The token will serve as authentication. The logic is to generate Toke from the app . Net and save it to a database.
This token must be related to the user identification in the PHP application. Therefore you need to solve a way to create this link.
A simple mode is a screen on . Net with a form where the user enters the login and password data for accessing the PHP application. These data would be saved in the app’s database. Net so you could link to the tokens.
Once the structure is done, we continue. When you click the button, the token is generated and the user is directed to the PHP app.
The PHP app receives the token and checks if it is valid by checking the database from which it was previously saved. For this query, an API (webservice) is recommended. Avoid making a query directly to the database. Consult for an API.
After verifying that the token is valid, if it is valid, it will search for the relationship with the user and make the authentication in the PHP app.
Important: The token must be deleted or invalidated whenever used. The token can only be used once.
Note that this is all independent of the languages you use on both sides. The app. net could be a Java app and the PHP app could be a Ror app. The logic of the authentication token is the same.