Salesforce OpenCTI API for lightning could not be initialized - salesforce

I want to write a sample demo using OpenCTI API for Lightning Experience. The
URL I mentioned in the CallCenter's Adapter URL refers to a page developed using JSPs and served from a third-party domain. So, based on the documentation below, I connect to the OpenCTI API using the script-Tag.
<script src="https://c.<yourInstance>.visual.force.com/support/api/40.0/lightning/opencti_min.js" type="text/javascript"></script>
N.B. Salesforce documentation: Connect To OpenCTI
The problem is, that at page load, the browser-console logs the following exception message:
"uncaught exception: Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters".
As subsequent problem, all OpenCTI functions return with error.
What am I doing wrong?

Related

Refused to frame 'https://www.facebook.com/' because an ancestor violates the Content Security Policy : "frame-ancestors https://www.facebook.com"

I've implemented the facebook sdk using npm package "react-messenger-customer-chat", which takes pageid and appid as props. I am injecting this code into shopify store (using iframe) using shopify scrpittags api. I've also whitelisted the shopify store domain on my facebook page, still getting this error. Can you please suggest me some solutions.
Check if your page is publicly visible.

OKTA Delete user session API is failing in angularjs

I am using OKTA default APIs( /api/v1/users/${userId}/sessions) for closing session across all the devices. The functionality is working as expected but the status is showing the API call is failed.
And also when we validate through Postman the 204 response code is returning but in angularjs the API call is failing.
Below is the API reference page which I have used in my application
https://developer.okta.com/docs/reference/api/users/#user-sessions
Please find the attached screenshot for your reference
Postman Response
There are few OKTA APIs which will support backend only for security reasons. So I have added client.endAllUserSessions(user.id)" method in my backend to remove user session across all devices. It is working fine for me.
(/api/v1/users/${userId}/sessions) API is failed in front end So we should call the "client.endAllUserSessions(user.id)" method in backend(Node JS) to clear user session.
For older okta-sdk-nodejs versions We Should call "client.endAllUserSessions(user.id)" method. For latest okta-sdk-nodejs versions We Should call "client.clearUserSessions(user.id)" method.
Thanks,
Subash.E

What is the best way to manage server redirect obtained under Angular translate JSON loading?

We are using AWS cloudfront to store our translation locale JSON files. Our Angular application gets these files via StaticFilesLoader in angular translate module.
In most cases it works perfectly. However after an environment is freshly created AWS could responses redirect to other location to get translation files. It is normal cloudfront behavior. But StaticFilesLoader is not able to follow this redirect and crashes with error:
XMLHttpRequest cannot load https://some.cloudfront.net/3...9-a...0-1..c-9...f/i18n/locale-en.json. Response for preflight is invalid (redirect)
Is there any known solution of this issue? Could you please give me some suggestion how to solve it?
A workaround could be to write interceptor to catch the redirect and fetch data with provided URL. But I decided to ask community before.

Getting No response from google drive javascript api

I'm using google drive javascript api(v2) in my reactjs project.
And I'm using this function to get files from google drive.
this.getProjectObjects = function(query, callback)
{
var request = gapi.client.drive.files.list({
corpus : 'DEFAULT',
q : query,
fields : 'items(id,description,title,properties)'
});
request.then(function(resp) {
callback(resp.result.items)
}, function(err) {
console.log(err)
});
};
After authenticate the user, I can get the files using this function.
But, when I navigate to other react component, it's no longer working.
There is no response or error, api just hangs.
Silly thing is when I refresh page, it's working. Again if I navigate to other component, it's not working.
I'm using the same query, nothing changed during navigating.
Anyone have any ideas what the issue could be?
Thanks
You may want to check the Chrome devTools to see if you are encountering any problem when switching pages. Also in the documentation - Getting Started:
There are several ways to use the JavaScript client library to make API requests, but they all follow the same basic pattern:
The application loads the JavaScript client library.
The application initializes the library with API key, OAuth client ID, and API Discovery Document(s).
The application sends a request and processes the response.
The following sections show 3 common ways of using the JavaScript client library.
Option 1: Load the API discovery document, then assemble the request.
Option 2: Use gapi.client.request
Option 3: Use CORS
See the sample for code implementation on effectively loading and making API calls.
Hope this helps.

Facebook adds parameters before # in Angular

I'm trying to do Facebook login using a sails.js backend only for REST API, no file serving (which we do in nginx).
I provide this as callback url to facebook: http://localhost/#/auth/facebook, but facebook prepends the code as a parameter before the hashtag, so http://localhost/?code=CODE#/auth/facebook, which causes angular/u-router to be unable to read it in stateParams/routeParams/location.
Any clues how to fix? Thanks!

Resources