function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wei Dong 10Wei Dong 10 

Embedded CORS doesn't work?!

Hello all:

I tried to embed my own website's page with Salesforce, and I've deployed my static HTML page into Azure as an example , the codes look like this following (this is the WebSite's URL:https://salesforcehtmltest.azurewebsites.net/).
 
<!DOCTYPE html>
<html>

<head>
    <meta name="salesforce-community" content="https://dev-conagradev.cs65.force.com">
    <meta name="salesforce-client-id" content="3MVG9aFryxgomHTbDJ87BGyiOIOX.JQ_GDxC3h1i72cfZeP_Wm9dgVzNm31vXngKKGYRv665beVbQQL_Bdq9d">
    <meta name="salesforce-redirect-uri" content="https://loginwidget.herokuapp.com/latest/_callback.html">
    <meta name="salesforce-mode" content="modal">
    <meta name="salesforce-target" content="#salesforce-login">
    <meta name="salesforce-login-handler" content="onLogin">
    <meta name="salesforce-logout-handler" content="onLogout">
    <link href="https://dev-conagradev.cs65.force.com/readyseteat/servlet/servlet.loginwidgetcontroller?type=css"
        rel="stylesheet" type="text/css" />
    <script src="https://dev-conagradev.cs65.force.com/readyseteat/servlet/servlet.loginwidgetcontroller?type=javascript_widget"
        async defer></script>

    <script>
        function onLogin(identity) {

            var targetDiv = document.querySelector(SFIDWidget.config.target);
            var img = document.createElement('img');
            img.src = identity.photos.thumbnail;
            img.className = "sfid-avatar";

            var username = document.createElement('span');
            username.innerHTML = identity.username;
            username.className = "sfid-avatar-name";

            var iddiv = document.createElement('div');
            iddiv.id = "sfid-identity";
            iddiv.appendChild(img);
            iddiv.appendChild(username);

            targetDiv.innerHTML = '';
            targetDiv.appendChild(iddiv);
        }

        function onLogout() {
            SFIDWidget.init();
        }

    </script>


</head>

<body>
    <div id="salesforce-login" data-login-event="onLogin"></div>
</body>

</html>

2) Add this website into CORS:
User-added image
3) When I run the page on Azure, it still doesn't work……Why?
User-added image
rocky balboa 4rocky balboa 4
The given code is really good and the way you have applied will also work. I will suggest you have some changes in it. Try to control the CORS from the header and you can also add the JSONP to this as well. 
I have also done the development like that and I have also faced the ERROR CODE 0XC0000428 (https://errorcode0x.com/error-code-0xc0000428/) in the module while debugging it.


 
Wei Dong 10Wei Dong 10
So how to cope with that in an HTML page? What should I do now?