WLAuthorizationManager.obtainAccessToken doesn't work when app uses proxy - ibm-mobilefirst

I need to have an Android app where I use a proxy URL to connect to our MFP 8.0 server. When I make an android build without proxy pointing directly to the MFP server the app registers in the server and I am able to see the push notification in my device.
But when using a proxy in the config.xml the app is able to reach the server but returns an error on the step where I do WLAuthorizationManager.obtainAccessToken.
This is the error:
errorCode:"201"
errorMsg:"Created"
responseText:"{"server_version":"8.0.2017081900"}"
status:201
statusText:"Created"

Related

Can't connect to localhost after expo update

I use expo and my iphone for create react-native application locally. A few months ago all was good. I used my local ip address for connecting to my local backend server. But after update expo started generate url as exp://r2-asw...exp.direct:80. Now I always get a connection error. I even can use my api via browser using my ip and port.
If I choose LAN instead Tunnel there is an infinity loader and get an error "There was a problem running the requested app. The request timed out"
The problem was in mac Brandmauer

How to change MobileFirst 8 server URL dynamically from client (Mobile Application)?

I am working on ionic 3 with MobileFirst 8.x in it. To connect server I have configured URL in config.xml file.
Is there any way to change server URL dynamically while using application?
URL change occurs only once and after that we will connect the services which are secure under any scopes.
MobileFirst server version :- 8.0.0.00-20170911-123510
MobileFirst Cordova(plugin) version :- 8.0.2017102403
I can see that provision was there in MobileFirst 7.x :-
https://mobilefirstplatform.ibmcloud.com/blog/2015/02/02/changing-server-url-runtime/
Yes. Use the WL.App.setServerURL to achieve this. Usage details here
You have not mentioned why you intend to use the API. This API comes handy in development environments. For example, switching between dev or staging server instances.
Important points to note:
1) As this API points the client application to a new server, client id associated with the earlier server is reset. The application will register fresh to the new server.
2) Authentication contexts created by the earlier server is reset. You will be challenged again by the new server.
You should use this API judiciously and with caution.

Deploying Adapter on Bluemix-MobileFirst Foundation

I have registered on IBM Bluemix. I've created a Mobile Foundation Service.
Now I wanted to deploy a JavaAdapter on bluemix-MobileFoundation. But getting some "FWLSE0321: state change Failure...exception" during deployment.
The adapter deployed successfully in my machine with local MobileFirst Server 8.0.
For locally installed server - POM.xml
<mfpfUrl>http://localhost:9080/mfpadmin</mfpfUrl>
so my question is, If I want to deploy Adapter on Bluemix-Mobilefoundation then,
what would be the "mfpUrl" ? and
In mfp Operation Console, from where I'll get this URL?
Thanks in advance!
When you open your MFP service from your dashboard, the name of the server will appear on the opened service's main overview page. It would be of the format
<server-name>.mybluemix.net
This will be your mfpfURL along with https:// and the server url must be followed by the port number ( the default is 443). Viz :
<mfpfUrl>https://<server-name>.mybluemix.net:443/mfpadmin</mfpfUrl>
And when the operations console is opened, the url of the opened page will consist your server url too.
You can get the URL from the MobileFirst Console. Make sure you use https and port 443

Failed to deploy the application to Worklight server

I installed worklight 6.1.0.1 on eclipse kepler from marketplace. I am getting the following error when I tried to build the application.
" Failed to deploy the application to Worklight server: please verify that the Worklight server is started and reachable.Connection to - 192.168.112.1:10080 failed. (Permission denied: connect)."
We send SOAP requests from the adapter. The backend services are only accessible if connected to VPN. I have connected to VPN and deployed the application. few JS files like dojo.js are pointing to local IP. For building the project to VPN IP , I right clicked the project and Run As>Build Settings and deploy targets. In the window that is popped up, I gave the VPN IP and cliked Ok. Again I right clicked project Run As>build all and deploy all. But still its being pointing to local IP 192.168.112.1:10080 and getting the error mentioned above when I try to deploy the application.
Even if I open project on worklight project console, its redirecting to local IP.
I think some ideas are mixed here.
Your application will be running in a local Worklight test server, that as part of Worklight Studio is placed in your development environment (localhost). If your adapters must use the VPN to reach the backend services, then you must only make sure the your-adapter.xml referes to the correct HTTP host (i.e. an IP address available through the VPN).
You should not need to change your local server address, i.e. if you double-click the Worklight Development Server in Servers view, the Host name field should be "localhost" (without quotes, that's the default value), or preferrable a local IP, may be 192.168.112.1 (or whatever local IP you have). If after trying all this, that still don't work, I'd change that to your VPN IP, but I believe that's not necessary.
One thing you may not be aware of is that when doing a build and deploy to Worklight Development Server, and you have the host name set to "localhost" the Worklight Studio will "guess" your IP, so that's probably the problem you are facing.
In a nutshell, what I'd do is:
1. Make sure your server host name is still localhost (or a fixed local IP address)
2. Make sure your adapter.xml file(s) refer to a correct IP or fully qualified host name in the VPN, so you can reach them.
3. Run As -> Build All and Deploy
4. Test
What I'm saying here is if you want your app built using the VPN IP, then you don't need to do it through Build Settings and Deploy Target, but just going to Servers View, double-click on Worklight Development Server and then set the Host name to the IP you want. The Build All and Deploy will do the rest for you.

Worklight: unable to access server after about 30 mins in background

My app is unable to access the server after about 30 minutes in background on Android phone and iPhone.
I know it should be related to the serverSessionTimeout. However, I cannot connect to server any more after that occurred, and I tried to invoke "WL.Client.connect()", but it didn't work. I always got request timeout response.
I test my app on local (without DMZ) via Worklight Studio embedded server, and it worked fine. Only get this issue on UAT (DMZ) and PROD (DMZ).
Project architecture:
1. DMZ (IBM IMC/LMC)
2. LAN
3. Worklight 6.0
4. Production environment
5. No Load Balancer and cluster setup
My assumption:
1. it seems the DMZ kept the credential between DMZ and WL server and didn't refresh it when try to connect WL server again after WL session is timeout.
This issue is fixed now.
The root cause is because we sent out two requests to WL server going through IMC at the same time, only the second one shake hands with WL server successfully.