phpCAS: checkAuthentication() redirection blocked by CORS

73 views Asked by At

Good morning,

I'm working on a project with a FrontEnd (ReactJS) and a Backend API (PHP - Symfony), where the Frontend is doing a POST request to an API endpoint where, with phpCAS, we are trying to know if the connected User has previously connected to another application in order to let the user being login without enter their credentials.

For this purpose I'm using the function phpCAS::checkAuthentication(), that returns true or false if the user has previously logged in the other app or not. This functions send a redirect (302) to the browser with the location of the SSO(Single Sign On) service, but the Frontend is blocking the redirection with CORS (because an API, by definition, can't return a redirect).

I would like to know if there is a workaround with phpCAS to work with fronts and API Backends, because it seems that it only works for static webpages where HTML webpages are sent to the browser instead of having an API Rest.

Has anyone faced this problem? How did you solve it?

0

There are 0 answers