Javascript - Backendless.UserService.loginWithGooglePlusSdk Access-Control-Allow-Origin

I am getting the following error using backendless v3 with Chrome (not tested with other browser).

login.html:1 XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘’ is therefore not allowed access. The response had HTTP status code 404.
login.html:158 Uncaught ReferenceError: createPopup is not defined
at gotError (login.html:158)
at Async.fault (backendless.js:631)
at backendless.js:1969
at Async.fault (backendless.js:631)
at XMLHttpRequest. (backendless.js:197)

Hey Barry,

The problem is with the domain, I believe: it should return a proper Access-Control-Allow-Origin header since this is a cross-domain request.
You can read more on it here and here.

I agree but I think it is the web server that is not returning the proper Access-Control-Allow-Origin header since this is a cross-domain request. Javascript is all client side.

If you provide me with a working example, I will test it using my server using custom domain.

Are you trying to login on a Standalone or Online version of Backendless?
Also, how did you manage to write the login code (it seems that there’s no documentation)?

I am trying to login using online v3 . Getting the code to work was a weekend of trial and error. 

<script src="[url=]"></script>[/url];
gapi.load('client:auth2', initClient);
    function initClient() {
    apiKey: 'apiKey',
    discoveryDocs: ["[url=$discovery/rest?version=v1]$discovery/rest?version=v1"[/url];],
    clientId: '',
    scope: 'profile'
$('#gplus_login').on('click', function () {

var fieldsMapping = {
"email": "email",
"given_name": "firstname",
"family_name": "lastname",
"client_id": ""
var stayLoggedIn = true;

Backendless.UserService.loginWithGooglePlusSdk(fieldsMapping, stayLoggedIn, new Backendless.Async(userLoggedInStatus, gotError));

backendless.js file

loginWithGooglePlusSdk: function (fieldsMapping, stayLoggedIn, async) {
 if (!gapi) {
 throw new Error("Google Plus SDK not found");
 if (stayLoggedIn instanceof Async) {
 async = stayLoggedIn;
 stayLoggedIn = false;
 var me = this;
 client_id: fieldsMapping.client_id,
 scope: "[url=]"[/url];
 }, function (response) {
 delete response['g-oauth-window'];
 me._sendSocialLoginRequest(me, response, "googleplus", fieldsMapping, stayLoggedIn, async);