PHP NodeJS验证

I would like my PHP based page (directory.domain.com) to use my NodeJS server to authenticate (api.domain.com). I have implemented passportjs on the NodeJS server for authentication.

I would like to authenticate the user through the NodeJS server when submitting a login form on directory.domain.com and create a session whereby the user can make post, get, put calls to the api.

Is this something that is possible? Is it as simple as creating a ajax request to the api and then setting a token?

Yes it is possible. Maybe the best way of doing this is using JSON Web Token (JWT) for authenticating the user (or the PHP Session) with the NodeJS API. More Info on JWT here: jwt.io. Under Libraries you also find multiple PHP and NodeJS Libraries to use.