WL.Client.Logout not calling its onSuccess or onFailure callbacks? - logout

Using Mobilefirst Platform 7.1,
I have noticed that logout function has stopped working. I have a browser web app which has a logout button which triggers:
WL.Client.logout("MyAuthenticatorRealm", {
onSuccess: function(res) {
console.log("success server logout"); // Never called :(
WLAuthorizationManager.obtainAuthorizationHeader().then (
function(header) {
// I would reload the app here,
},
function(error) {
...
});
},
onFailure: function(res) {
console.log("failure server logout"); // Never called :(
}
});
But callbacks are never called.
I have checked the sample code from this tutorial and I can see the same thing happening too.
Is there something specific I need to add in 7.1? This used to work in 7.0
EDIT 2015/08/31
There is nothing in the server logs. The client web app seem to be doing a request to authorization/v1/authorization?client_id=XYZ&scope=-MyAuthenticatorRealm&isAjaxRequest=true&x=0.07530371774919331 which returns 200 success.
EDIT 2013/09/17
With the new version (7.1.0.00.20150913-2345) the callback is called! However now I get an exception:
Uncaught ReferenceError: WLAuthorizationManager is not defined
Is this the correct way to do the logout for the latest version? I am trying the "Desktop Browser"

There is a known issue currently in MobileFirst Platform 7.1
APAR PI47591 WL.CLIENT.LOGOUT DOES NOT WORK IN HYBRID PREVIEW
You can open a PMR with IBM to share your interest for this fix, and get updated.

Related

Flutter and Socket.io: No reaction from code, no errors, unable to debug

I'm creating an app which should trigger a longer process in my nodejs server whereas the app should receive progress updates via socket.io.
The node server with socket.io works fine, I already tested it with a web client in the browser. However, I can't get the flutter code of the socket_io_client 1.0.2 package to execute in my flutter app.
This code is inside a method which is called once a user presses a button:
try {
print("step 1");
IO.Socket socket = IO.io('http://localhost:3000',
OptionBuilder().setTransports(['websocket']).build());
socket.on('connect', (_) {
print('connect: ${socket.id}');
socket.emit('process1', json.encode(_req));
});
socket.on('progress', (data) => print(data));
socket.onDisconnect((_) {
print('disconnect');
_finished = true;
});
} catch (e) {
print(e);
print("error");
}
print("step 2");
When clicking the button, the method executes, but not the socket part. In the console, I immediately get
step 1
step 2
but nothing else happens: The console logs the test statements immediately and the server never notices any incoming connections ... it is as the socket.io related code is just never executed. No errors, no console messages, nothing!
Does anyone have an idea why the codes behaves like this, why nothing happens?
Flutter (Channel stable, 2.10.4)
socket_io_client: ^1.0.2
I had the same problem with same versions of flutter and socket_io_client.
After changing the sockit_io_client to version ^2.0.0-beta.4-nullsafety.0 it was working.
https://pub.dev/packages/socket_io_client/versions/2.0.0-beta.4-nullsafety.0
There are many discussions about it on their github page. Will be fixed in the next releases.

Why Google Pay doesn't work from iPhone Safary after an ajax request?

I try to add a Googla Pay button on a website. I follow the Google Pay implementation tutorial (https://developers.google.com/pay/api/web/guides/tutorial).
There is a code:
var paymentsClient = getGooglePaymentsClient();
paymentsClient.isReadyToPay(getGoogleIsReadyToPayRequest())
.then(function(response) {
//...
})
.catch(function(err) {
//...
});
I need to get some data from my server side before I call the above code so I do the http post request. Within success hanlder of my post request I call the above code. It works fine in my Android browser and my laptop browser. But it doesn't work from Safari. I get the "Unexpected developer error please try again later" error. If I call it without ajax request it works in Safari as well. Could someone suggest the solution?
Thanks for including the jsfiddle.
The reason that it's not working is because Google Pay tries to open a popup window when you call loadPaymentData in Safari. When a new window is triggered as the result of a click event (user initiated action), the popup window opens as expected. When it is triggered by a non-user initiated action, Google Pay gets loaded in the same window which ends up causing it to fail.
It looks like when you make an ajax request in the click handler and then call loadPaymentData, Safari considers it a non-user initiated action.
Check out the following example in Safari:
const ajaxButton = document.getElementById('ajax');
const nojaxButton = document.getElementById('nojax');
ajaxButton.addEventListener('click', event => {
$.get('/echo/json/', () => {
window.open('about:blank');
});
});
nojaxButton.addEventListener('click', event => {
window.open('about:blank');
});
I would recommend avoiding making any http calls on the button click event before loadPaymentData. If you can fetch the data before the button is clicked, then do so.
Out of interest, what kind of data are you fetching?

canShareVia invokes the success callback when it should not - iOS 11.2

Description
When the Facebook app is not installed, canShareVia method should invoke the error callback, which is working perfectly with my iPhone5s running iOS 10.
When I test it on iPhone5s running iOS 11.2, it is always invoking the success callback in both the cases where the Facebook app is installed and Not installed.
App
A Cordova mobile app
Plugin: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
Device information
iPhone 5s
iOS 11.2
Facebook app: Not installed
Sample code
window.plugins.socialsharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null,
function(success) {
do some stuff....
}, function(error) {
alert(error);
});
Please let me know if any work around has been found.
Updated
Found the cause:
This plugin always returns true since iOS11. So we might need another way to detect if there is an app installed and available.
Get it to work with cordova-plugin-appavailability.
You can implement this way (Appavailability plugin to check Facebook app availability and social sharing plugin to do the actual sharing).
appAvailability.check(
'fb://',
function() { // Success callback
window.plugins.socialsharing.shareViaFacebook(...)
},
function() { // Error callback
console.log('Facebook App is not available');
}
);
Though this is a work around but not a fix, this is the only way for now until the fix gets merged to cordova-plugin-x-socialsharing.
You can find the answer for your question here.
App Availability.
Read this and your requirement will be piece of cake.

Issue with register device in MFP8.0

We are developing ionic app with mfp8.0. We have tried to register our device for push notification by using the following code,
function isPushSupported() {
MFPPush.isPushSupported(
function(successResponse) {
alert("Push Supported: " + successResponse);
registerDevice();
}, function(failureResponse) {
alert("Failed to get push support status");
}
);
}
function registerDevice() {
WLAuthorizationManager.obtainAccessToken("push.mobileclient").then(
MFPPush.registerDevice(
null,
function(successResponse) {
alert("Successfully registered");
},
function(failureResponse) {
alert("Failed to register device:" + JSON.stringify(failureResponse));
}
)
);
}
Not able to register the device now. While getting inside the registerDevice() function App is getting stopped.
Actually, We are getting this error recently. Before that the same code was working fine for us.
I have referred the documentation. But, I am not getting the solution.Link which I have reffered is,
https://github.com/MobileFirst-Platform-Developer-Center/PushNotificationsCordova/blob/release80/www/js/index.js
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/
Note:
GCM recommeded to make use of FCM now, refer the following link,
https://developers.google.com/cloud-messaging/
Actually, after register my device with FCM credentails only I am facing the issue.
Anyone help will be Appreciated!!!
Please make sure you are following the correct instructions. The instructions are layed out in the following page: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/
Visit the Firebase Console.
Create a new project and provide a project name.
Click on the Settings "cog wheel" icon and select Project settings.
Click the Cloud Messaging tab to generate a Server API Key and a Sender ID. and click Save.

blank error message on errThrown-ajax call

$.ajax({
url: loginPath,
password: Password,
username: Username,
type: "GET",
error: function(xhr,textStatus,thrownError)
{
alert(textStatus+" "+thrownError);
},
success: function(data)
{
alert(data);
}
});
I am developing an application in Phonegap for iphone & android, my application needs to call web services at a point, now when i call the web service as above, the alert(textStatus+" "+thrownError); show only "error" the thrownError parameter is blank, all this happens when i run the application on the device/simulator, if i run my code on safari it works just fine without any error, but on the device it somehow screws up. Can some1 tell me what i'm doing wrong? or is there any problem with the web services.
P.S: when i say device i mean iPhone 3GS, as of now i am testing it on this device.
Try alert(xhr.statusText); in the error function.