Enable Your Embedded Application to Call CRM APIs

You can enable your embedded application to call CRM APIs using JSON Web Tokens (JWT) by including the following Javascript in your mashup content (the code of your application):

<script type="text/javascript">
function init()
{
if (typeof window.addEventListener === 'function')
{
window.addEventListener('message', receiveJWTToken, fasle);
}
else if (typeof window.attachEvent == 'function')
{
window.attachEvent('onemessage', receiveJWTToken);
}
else
{
throw new Error("Browser doesn't support addEventListener or attachEvent");
}
payload = {}
payload.origin = window.frames.origin;
payload.methos = 'requestJwtToken'
window.parent.postMessage(JSON.stringify(payload), '*');
}
function receiveJWTToken(token)
{
//consume token.data;
}
init();
</script>

The application uses window.postMessage() to first get the JWT Access Token. The script creates an event listener to listen to postMessage(), then requests a token. You can edit the error message in the init() function.

Replace the logic in the receiveJWTToken() function to process the JWT Access Token provided by Oracle in a way that it meets your embedded application's requirements.