getAccessTokenAsync returns 13001 only on safari - safari

I'm using OWA in safari and when I call getAccessTokenAsync it return 13001, but it works fine on chrome
Windows (ie, edge, chrome) works fine
MAC (chrome) works fine
MAC (safari) return 13001
I have try to pass { forceAddAccount:true }
Office.onReady().then(function (value) {
Office.context.auth.getAccessTokenAsync({ forceConsent: false }, function (result) {
console.log('Checking token: ' + result.status);
});
});
Expected result: status:'succeeded'
Actual result: 13001 the user is not signed in Office

You need to check if you have 3rd party cookies enabled or disabled on Safari. If disabled, can you follow the instructions given here to enable 3rd party cookies:
https://www.clubrunnersupport.com/article/710-enable-third-party-cookies-for-safari

Related

Facebook login api still gives the error of https required even if app is in dev mode

I created a test app on facebook and set the domain and the site url to localhost and http://localhost:4200 respectively.
The app is in development mode, as the documentation says "You will still be able to use HTTP with “localhost” addresses, but only while your app is still in development mode", nevertheless I get the error "The method FB.login will soon stop working when called from http pages. Please update your site to use https for Facebook Login." when I invoke the FB.login() api.
Sometimes the facebook window to log the user is not displayed , other times the window opens with the error "Login Error: There is an error in logging you into this application. Please try again later." within.
Update
I'm over https in locale and the relative error is disappeared.
This is the function invoked by the "Login with Facebook" button
loginWithFacebook() {
this.btnLoaderFB = true;
this.auth.facebookInitializer()
.then(() => {
this.auth.facebookInitialized = true;
return this.auth.facebookLoginStatus();
})
.then((loginStatusResponse) => {
console.log(loginStatusResponse);
if (loginStatusResponse.status !== 'connected') {
return this.auth.facebookLogin();
} else {
return this.auth.getFacebookProfileInfo();
}
})
.then((profileInfo) => {
console.log(profileInfo);
this.auth.loginWithFacebookRemote(profileInfo)
.subscribe(
res => {
this.btnLoaderFB = false;
}
);
})
.catch(err => {
console.log(err);
this.translate.get('t.validation.error_fb_login').pipe(takeUntil(this.unsubscribe)).subscribe(
t => {
this.error = t;
this.btnLoaderFB = false;
});
});
The first time I call this function I receive the response from facebookLoginStatus() logged on the console
I enter the fb credential and I get this error
If I try to click again on the button I receive the same response from facebookLoginStatus() I showed in the first image and the facebook popup window shows the same error message in the previous image.
If I reload the page the facebookLoginStatus() response is what I expect for a logged user on facebook and the login process ends without error
I can recommend using https even on localhost, especially because you will have a system for testing that is more similar to the live environment. This solves the Facebook https issue once and for all.
For Node.js, it is very easy with this tool: https://github.com/davewasmer/devcert
For PHP, you may want to take a look at this thread: How do I allow HTTPS for Apache on localhost?
For Angular CLI: Get angular-cli to ng serve over HTTPS

Login to salesforce.com with Phantomjs 2.0 keep asking for verification code

We are doing some tests to connect to the salesforce.com with Phantomjs 2.0.
It was working pretty good, but in the last couple of weeks salesforce.com kept asking for the verification code every new session.
Is anyone experiencing the same issue?
You can whitelist your IP address in order to stop Salesforce for asking the verification code.
Go to Setup -> Security -> Network Access and add your IP to whitelist.
This should perhaps be a comment, but as I do not have the required points to comment please forgive the "answer". This is a working answer, as I'm not very proficient in casper/phantom I will update on attempted solutions. Hopefully my attempts will help someone else.
Is anyone experiencing the same issue?
A: Yes
Problem: As of Salesforce Spring '16 update when logging into SF from a new browser SF authenticates the user with a verification code (can be tested with a new browser eg.firefox). Oddly the issue doesn't replicate with an incognito session.
Proposed solution: Create a cookies file & login to SF with the casper/phantom scripts. Saving the authentication to the JS cookies file, otherwise every login will require a verification.
Testing steps:
We can see the verification form using casper/phantom.
var fs = require('fs'); //top of script
var html = this.getHTML(); //place this in wait_function() after login()
fs.write('./output.html', html, 'w');
We can now "fill" the verification form with the emailed code
this.click('phSearchInput', function () { //'phSearchInput' found in above extract
this.fill('form', {
'phSearchInput' : '*verification_number_here*'
}, true);
2.1 There seems to be an issue with the final redirect after the verification. I'm not sure how much time I can give this (as it's not a priority) and I'm quite new to JS. I'll leave the code here for reference/testing
/*Altered from http://blog.deadlypenguin.com/blog/2013/07/09/logging-into-salesforce-with-casperjs/ */
var LOGIN_URL, LOGIN_USERNAME, LOGIN_PASSWORD, casp;
casp = require('casper').create({
viewportSize: {
width: 1024,
height: 768
},
verbose: true,
logLevel: 'debug'
});
casp.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4');
if (!casp.cli.has('username') && !casp.cli.has('password')) {
casp.echo('Usage: $ casperjs sfdclogin.casper.js --username=USERNAME --password=PASSWORD [--prod]').exit(-1);
}
if (casp.cli.has('prod')) {
LOGIN_URL = 'https://test.salesforce.com//';
} else {
LOGIN_URL = 'https://test.salesforce.com/';
}
LOGIN_USERNAME = casp.cli.get('username');
LOGIN_PASSWORD = casp.cli.get('password');
casp.start(LOGIN_URL, function () {
this.log('Logging in', 'debug');
//login
this.fill('form', {
'username': LOGIN_USERNAME,
'pw': LOGIN_PASSWORD
}, true);
this.log('Logged in', 'debug');
});
casp.wait(5000, function () {
this.log('Varification START', 'debug');
this.fill('form', {
'emc': '*verification_number_here*'
}, true);
this.captureSelector('test.png', 'html');
this.log('Varification FINISHED', 'debug');
this.wait(6000)
}, 12000);
casp.then(function () {
//casp.waitForUrl('https://cs31.salesforce.com/home/home.jsp', function() {
this.log('Are we logged in??');
this.captureSelector('test2.png', 'html');
}, 12000);
casp.run();
Add a cookies file in hopes the verification validation is saved there. (I'll get to this when I figure out step 3).

Internet Explorer 11-Only Code

I'm trying to insert a code for a website client of mine that works specifically for IE11, which is producing a DIV in the wrong manner (but not in any other browser). When I fetched the browser to display in the browser, IE11 said Mozilla 5.0...what?
I'm using:
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
echo '<div style="position:relative; top:-15px;">';
}
[non IE code]
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false) {
echo '</div>';
}
Help?
This may help.
IE 11 has user agent strings changed and that is the reason why you see MOzilla/5.0 when you output the browser user agent string. For more information
IE 11 sends different User-Agent header to different subdomains
http://msdn.microsoft.com/en-us/library/ie/hh869301%28v=vs.85%29.aspx

Ajax call with basic authentication works on desktop butnot on device browser

I have a weird issue.. I am trying to call a REST URL which is secured with basic authentication over https but for some reason the call doesn't go through when I perform it from a mobile device (iPhone/iPad). When I remove the basic authentication from the service the call goes through with authentication it just times out.
When I try to debug it on my desktop it works fine .. does anybody have any idea why this wouldn't work?
My call looks like this:
var values = this.getLoginForm().getValues();
Ext.Ajax.request({
url : '/some/relative/url/',
method : 'GET',
username: values.username,
password: values.password,
success: function(response){
loggedIn = true;
Ext.Msg.alert('Success', 'Logged In');
},
failure : function(response) {
Ext.Msg.alert('Error', response.responseText);
}
});
I tried with relative URL and with absolute and there seems to be no difference.
I am using Sencha Touch 2.3.1.

does signalr work with IE 9?

I have a web site MVC4c#. I installed signalr 1.0.1
It works great on firefox. but on IE9 cannot connect
my code :
var myHub= $.connection.myHub;
$.connection.hub.error(function () {
alert("error connect");
});
$.connection.hub.start(function () {
}).fail(function () {
alert("error connect");
}).done(function () {
alert("connect");
});
with firefox it's working . IE 9 no. it used to work with the previous version of SignalR .
sinse I installed package fron nuget 1.0.1 it stoped working on IE.
in IE developers tools I don't see javascript error, in network capture I see:
every 10 seconds it does 2 request: Key Value Request GET
localhost:51090/signalr/ping?_=1363305928522
HTTP/1.1 response {"Response":"pong"} and Immediately another request :
http://localhost:51090/signalr/reconnect?transport=longPolling&connectionToken=pKuceZE_v-uecAzzq4rgj4Gz6AY1KagOgnzwqtG197hftvZOfK_LDqMo9VI5iRnkX4f2K9Wno7tBzVTxrLi4Xs7doGsChAkL6ejRykvTtDMHMdNR-FlScXPT4wwNeD7Y-AZa1Rb5XVpDUsv2S2qXs3ZSWjxJg9uGiq1QYLG1FUfMVMVDQq8aoDWLjkUGk2CR0&connectionData=%5B%7B%22name%22%3A%22tradehub%22%7D%5D&messageId=B%2C2%7CL%2C2%7CM%2C0%7CN%2C0&tid=3&_=1363305928541
with no response