I have a headless Drupal instance as backend and frontend in React JS. I am using Simple OAuth 2.0 for authorization and all the end points work fine with authorization. Now I have a use case where I need a User to login to frontend which happens with the simple Oauth 2.0 endpoint ‘/oauth/token’. Once the user logs in, they land to frontend home page and there is a link to backend, which if clicked should automatically log in the user to backend (Drupal site).
I have tried multiple options like login endpoints provided by JSON API, which successfully authenticate the user, creates a session in backend and sent cookie in response, which is received by React JS but couldnt be saved. DUe to this, the access to backend from frontend is always considered as unauthorized or Anonymous user request.
I tried to login user programatically too, but it lands me in ‘/contextual/render’ error for many of the pages in admin section of backend.
Please help me in creating a SSO for both backend and frontend.