Authentication on react app using pega auth service
Our use case involves a React application that is connecting to Pega via DX API's. On react side, the requirement is to have an authenticated and unauthenticated journey of the user. I understand from the documentations that the we can give authservice in the sdkconfig json file. We have OpenID as our IDP , and we created an authentication service on Pega and added the alias for that in the sdkconfig file. When we are loading the react page, it is trying to authenticate in a popup window and its presenting us the IDP login page. We have following queries where we are stuck for now -
1. How to initiate the IDP login on the same page of react instead of a popup.
2. Since we have an unauthenticated journey, there are certain pages on the react app which the user can use without any authentication. We have a login button on the click of which the authentication flow should start and connect to the IDP. Currently, since we have given the auth service in the config json file, it is launching the authentication as soon as the page loads but we want to trigger that on the click of the login button. Unless the button is clicked, the DX API calls should happen via a common operatorID and after user logs in, it should switch to the logged in user operator ID.
3. the opposite of point 2 should happen if the user clicks on log off.