Using Lightning component and apex when I navigate to below URL I am getting No_Oauth_State: State was not valid error message. Though I provided state in URL. I try to communicate between two dev org. Please let me know where I need to store the state variable used in authorization and how to compare that from auth URL.
https://login.salesforce.com/services/oauth2/authorize?response_type=code&grant_type=authorization_code&scope=openid&client_id=3MVG9Z&client_secret=09&redirect_uri=https://login.salesforce.com/services/authcallback/xxx/SFDC_IDP&state=00D7F000002DBeJ%21ARMAQ
All other configuration is correct because using same config I am able to login via SSO, but when I tried the same using apex and lightning component getting error message.
Thanks
2 respuestas
Hello Rajesh,
Thanks for your response. but I have already gone through the link. It was not mentioned there how to implement and use state.
I am using below code in lightning component to store the state in browser cookie and navigate to authorize URL.document.cookie = 'state='+state;
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": urlName
});
urlEvent.fire();
It will be really helpful if you can tell me how to compare that State from the URL return by IDP in lightning component/apex.