How to solve "wl_deviceNoProvisioningRealm. null returned for key: userId" error? - ibm-mobilefirst

I'm using the command
WL.Client.getUserInfo("wl_deviceNoProvisioningRealm", "userId");
to get the deviceId of the user and send it with other informations with an adapter.
The problem is that every time I update the app, even giving it another version number, I start getting the error below every time the code is called
wl_deviceNoProvisioningRealm. null returned for key: userId
I can fix it if I call a WL.JSONStore.destroy inside wlCommonInit(), but of course I can't do it in a production environment.
The code to get deviceId is called twice, one of them is when I initialize the collections, inside "adapter..load..params".
Is that a way to fix it?
Thank you in advance.

I discovered my problem.
Actually, the method I was using to get deviceId uses a realm that lies in worklight server.
So, I need to set connectOnStartup to true or call WL.Client.connect().
As my application need to work offline, I'm using the Apache Cordova device.uuid instead.

Related

ApplePayJS InvalidAccessError

Trying to integrate ApplePayJS into my website and getting this annoying message::
InvalidAccessError Code 15
"The object does not support the operation or argument"
Everything seems to have been going well and now nothing works.
If you get this error, in my experience Safari is now dead to ApplePayJS and you must start by force quitting and reopening it again.
Turns out the reason for me what that the ApplePay API completely craps out if you pass a string instead of an object into the completeMerchantValidation.
If what you return from your server is not JSON object, but a string instead then you can do this:
session.completeMerchantValidation(JSON.parse(merchantSession));
Or better still - fix your server to return a JSON object instead of a string.
Update 4 years later:
I just saw this again today for a real customer as opposed to during my own testing. In this instance the order had succeeded and the customer thought it had failed so attempted to go through the process again.
Oddly it was on this call with the same error "The object does not support the operation or argument."
applePayTokenize.session.completePayment(ApplePaySession.STATUS_SUCCESS);
Since the payment succeeded I've changed my logic to just ignore the exception (for STATUS_SUCCESS only) and proceed to the final page. I don't even know if the ApplePay sheet was still open but even if it was at least when it cancels it will be on the receipt page.
I have also had this issue but with a different reason
Your domain name in the session needs to equal the domain name of your browser. you set the domain name in the backend during in the initiativeContext
https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/requesting_an_apple_pay_payment_session

SetHITTypeNotification does not take the Notification destination

I am using Mturk Sandbox environment. I have also created a queue (SQS) which will receive assignment submitted notification. I am trying to call SetHITTypeNotification API. But it always gives me following error
The value "https://sqs.XXXXXXXXXX.amazonaws.com/XXXXXXXX/XXXXXXXXXXX" is not valid for the parameter Destination.
I am sure I am providing the destination correctly. Can anybody suggest what I am missing here ?
The issue was with &Notification.1.Transport=Email which needs to be passed along with the API URL.
I changed it to &Notification.1.Transport=SQS and it works like a charm.

Why isn't a client-side HTTP.get() call working in Cordova (Meteor 0.9.3)?

UPDATED QUESTION:
A simple client-side HTTP.get() call is not working on the iOS emulator. The same call is fetching data and its displaying perfectly in my templates in the browser (localhost:3000)
Earlier I thought this got to do with local collections, but the problem is actually with the HTTP.get call which is not returning any data within cordova (ios emulator or device).
Please note that my entire code is only on the client if (Meteor.isClient) {} and nothing in if (Meteor.isCordova) {}.
ORIGINAL QUESTION: Is it possible to define a local collection in Cordova (Meteor 0.9.3)?
I have a local(client-only) collection in my app as shown:
Items = new Meteor.Collection(null);
This local collection temporarily gets data from an external API ( by adding 'meteor add http' and using HTTP.get() ) and this content is pushed to the templates. This is appearing perfectly in the browser templates on localhost:3000 through the helpers ( return Items.find() ), but when I run 'meteor run ios', the data is not loading up in the iOS simulator.
First of all, is it even possible to expect a local collection to work within Cordova?
Should this be defined inside:
Meteor.isCordova({ })?
Does it require a cordova-specific package to be added?
I believe a local collection is necessary in this case because the data is retrieved based on the user's device location and its relevant only for the current session.
Any thoughts would be appreciated.
(meteor noob here, sorry if this sounds stupid!)
EDIT: Collections defined both on the server and client are working in the browser as well as on iOS emulator. So the problem is only with local collections.
#imslavko
You're indeed right! Its the CORS issue on the server to which I was making the API call.
After a couple of days of breaking my head, I eventually figured out the server did not have Access-Control-Allow-Origin: * for simple GET/POST requests.
Thanks for your help in figuring this out.
So it turns out Cordova has nothing to do with this. All HTTP.get() calls are working perfectly from within Cordova too including local collections.
There's one more trick to be aware of.
HTTP.get('/route') will likely end up in the phones local server instead of the remote server the data comes from - so you wont be receiving the data you'd expect.
Instead use
HTTP.get(__meteor_runtime_config__.ROOT_URL + '/route')
Because the ROOT_URL variable points to the correct server in both Cordova apps and normal browsers.

Laravel 4: when using Config::set to change auth.model then Auth::user() not work

My laravel project has two login system.
1) Using user_name and Password
2) Using secret code
my 1st login system work properly. because auth.model has 'User' model.
so I use 'Config::set' in 'tempSing' method to obtain 2nd login as bellow.
Config::set('auth.model', 'TempUser')
Config::set('auth.table', 'temp_user')
After that code I use bellow code
$user= TempUser::where('secret_code','=',Input::get('code'))->first();
Auth::login($user,true);
if(Auth::check())
return Redirect::route('getTemp');
then that code work properly and redirect to the 'getTemp' and after routing it make 'temp.php'. but their include
if(Auth::check())
so my problem is above logic not become true. that problem is occurred when using 'Config::set' but I Configured 'auth.model' and 'auth.table' manualy in 'auth.php' not happen any error. Please help me.
I would assume Laravel initializes the Auth service once when the application is started, so later edits to configuration don't affect it anymore. A solution would be to initialize an instance yourself, and use that.

IAT/EAT hooking "gethostbyname"

I wrote this code to hook API functions by changing the address in the IAT and EAT: http://pastebin.com/7d9N1J2c
This works just fine when I want to hook "recv" or "connect". However for some unknown reason when trying to hook "gethostbyname", my hook function is never called.
I tried to find "gethostbyname" in a debugger by taking the base address of the wsock32.dll module + 0x375e, which is what the ordinal 52 of my wsock32.dll is showing as offset. But that just makes me end up in some random asm code, not at the beginning of a function.
The same method however works fine for trying to find the "recv" entry point.
Does anyone see what I might be doing wrong?
I recommend this tool:
http://www.moduleanalyzer.com/
They do exactly the same and show the url that was connected with that API.
The problem is that there are more than one API to translate an url to an address. The application you are hooking may be using another version of the API that you're not intercepting.
Run some disassembler like IDA and attach to your process after you hook this functions, ida get apply changes on attaching and play process and check what is wrong.
In other way you have many libraries to do hooks with trampolines like Microsoft Detours, NCodeHook etc.