You are here:
Create an Embedded Login Client-Side Callback
To create a client-side callback, you add a web page to your website and specify a few
Embedded Login meta tags inside the <head> HTML
element.
Embedded Login relies on third-party cookies, which are blocked or restricted in most browsers. And Embedded Login works only on Google Chrome and only as long as third-party cookies are allowed there by default.
The client-side callback takes the access token from Salesforce and writes it to local browser storage for future access. Regardless of how many web pages that you add login capabilities to, you create only one callback page.
- Create a page on your website and call it _callback, for example, _callback.php.
-
Enter the following required meta tags inside the
<head>HTML element of this _callback page.- salesforce-community
- salesforce-allowed-domains
- salesforce-mode (where the value ends in -callback)
Note The value of the salesforce-mode meta tag is the same mode specified in the Embedded Login web page with the -callback suffix. For example, if salesforce-mode on the web page is set to modal, the value is modal-callback. -
If desired, enter these optional meta tags.
- salesforce-save-access-token with the value
trueto save the access token after initialization. By saving the access token, you can continue to interact with Salesforce during the active user session. - salesforce-logout-on-browser-close
- salesforce-save-access-token with the value
-
Keep the body empty:
<body></body>.
<html>
<head>
<meta name="salesforce-community" content="https://embeddedlogin-dev-ed.my.site.com/demo">
<meta name="salesforce-client-id" content="3MVG9Iu66FKeHhIPrRneLTDFdiuLfgLjycFpg6SbLpZAJScEXuD.oRdaWnJE7QGNFWHxunp0ut1">
<meta name="salesforce-mode" content="inline-callback">
<meta name="salesforce-save-access-token" content="false">
<meta name="salesforce-allowed-domains" content="embeddedlogin.heroku.com">
<meta name="salesforce-redirect-uri" content="https://embeddedlogin.heroku.com/_callback.html">
<meta name="salesforce-target" content="#salesforce-login">
<meta name="salesforce-login-handler" content="onLogin">
<meta name="salesforce-logout-handler" content="onLogout">
<script src="https://embeddedlogin-dev-ed.my.site.com/demo/servlet/
servlet.loginwidgetcontroller?type=javascript_widget" async defer></script>
</head>
<body></body>
</html>

