Android, Bluemix Error 401 : You are not authorized - android

I downloaded the sdk from here, created an application but when i run the app the logcat notifies:
Error 401, Failure: You are not authorized.
I tested the Bluemix app with the sample code you can find here, obviously switching the default parameters with my app's ones.

Solved.
I downloaded the April jars, the most recent ones. That worked.

A 401 error sounds as if the Mobile Application Security (MAS) is not set up correctly. Could you try going to your mobile back end on Bluemix, clicking the MAS service, turning the "Enable Client List" switch to on, and then adding your bundle id under iOS? Additionally, confirm that you've copied the client-id & client secret correctly into the properties file for the application.

Related

Problem configuring Flutter "sign_in_with_apple" for android

I am trying to set up the Flutter sign_in_with_apple package but run into problems with the android side.
What I have done so far, following the package README to the letter:
Set up the glitch.me server. The server is up and listening at https://MYSERVER.glitch.me/callbacks/sign_in_with_apple I've added a bit of console logging to make sure I know when the server is hit.
Set up appid and serviceid on the apple developer console. Service identifier is com.company.foobar.dev.signin
Added the glitch callback https://MYSERVER.glitch.me/callbacks/sign_in_with_apple as the return url on the service configuration.
Copied the activity block from the readme into my android manifest. NOTE: I didn't know what to set the name. Leave it referring to the package or change it to my app id? It's currently android:name="com.aboutyou.dart_packages.sign_in_with_apple.SignInWithAppleCallback"
Add this block to my flutter service:
"https://MYSERVER.glitch.me/callbacks/sign_in_with_apple";
final appleIdCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
webAuthenticationOptions: WebAuthenticationOptions(
clientId: "com.company.foobar.dev.signin",
redirectUri: Uri.parse(redirectURL)));
Unfortunately, the call to SignInWithApple.getAppleIDCredential in step 5 throws an exception and I am seeing invalid_request invalid web redirect url. The glitch server is never even hit, which makes me think that even if I messed up at Step 4 (the intent name in the android manifest) the problem is more likely in the apple developer console setup. However, I am pretty sure I've followed the README and I am running out of ideas.
Hmmm, I threw away the apple developer console service setup for the dev package (with applicationIdSuffix '.dev' and bundleid 'com.company.foobar.dev') and set up the same for the production flavor. This one works as expected.
I am now wondering if apple doesn't even redirect the request to the glitch server for android unless the package has as playstore presence. Comments?

Error: ConnectFailure (No route to host)

Context: I have a Xamarin.Android app that it connects to an WebAPI for different information.
Issue: When trying to access the server I get the following error:
System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: ConnectFailure (No route to host)
Issue context: we have 2 servers in the same network, configured the same (at least we hope so, is at client site) and if we use the same app (same build) we can connect to server A, but get the mentioned error when connecting to B. About the B server: I can access from device browser the http://address/help or /token page, I can also do the desired request from 'REST Api Client' from Google Play and get a successful response. The only problem it seems when connecting from our app to the server B. This issue is also not present on our environments (as I mentioned, the A and B are at client site).
Question: What would be the problem and where should we look further?
Thank you!
I found this answer on Xamarin forms, this didn't solve my problem, but maybe it could help in yours. https://forums.xamarin.com/discussion/70731/connection-error-no-route-to-host-only-happens-on-android
I had this problem because I didn't dispose my HttpClient object. It didn't happen with the first or second request, however from request 10 it would start giving me problems. Especially when they were happening asynchronously.
I don't know if this will solve your problem, as both these seem to be a special case instance. Maybe yours is a special case as well.
Check the mobile device can able to access the API server first. Is completely related network issue. Might be your mobile app and web server used different LAN connections or WIFI networks.
I had same issue, fixed it by enabling fast deployment:
In solution explorer, right click on 'yourproject.Android' -> 'Properties' -> 'Android Options' -> check 'Use Fast Deployment'
In my case, the problem occured only when running the application through the Visual Studio 'Run' button (I used a physical device to debug on).

404 Error when running TicTacToe sample (Android) against sample Google App Engine project (Java)

I set up the Android App and Google App Engine backend as seen in these two projects:
Android Connected App Engine Project
Java App Engine Backend Project
When I click a TicTacToe-field button, which triggers a request I get an 404 error: "Not found"
04-09 23:11:51.115: W/TicTacToe(26247): GetComputerMoveTask: 404 Not Found
04-09 23:11:51.115: W/TicTacToe(26247): Not Found
That is exactly the what https://myappname.appspot.com/_ah/api/ in the browser shows "Not Found".
Here is what I did:
Created an api project on App Engine Console
There created an Android Client Id with com.google.devrel.samples.ttt as package an my debug keys SHA1-fingerprint
There created a Web Client ID
Integrated the Android Project in eclipse. Updated DEFAULT_ROOT_URL in Tictactoe.java to "https://myappname.appspot.com/_ah/api/"
There updated the value of AUDIENCE in ClientCredentials.java by replacing the string "your_web_client_id" with the generated web-client-id from step 3
Integrated the Java backend project in eclipse.There updated the value of application in appengine-web.xml to myappname
Updated the values in /spi/Ids.java to reflect the web-client-id and android-client-id from step 2 and 3
Updated the value of google.devrel.samples.ttt.CLIENT_ID in war/js/render with web-client-id
Deployed the backend to google. Worked great - it opend the https://myappname.appspot.com/ page showing the correct page after deploying (servlet)
Deployed the android app and tried to make a move in TicTacToe. The app crashes.
I think its very suspicious my DEFAULT_ROOT_URL is set to "https://myappname.appspot.com/_ah/api/" in my Android app whereas this pages show just "Not found" in the browser.
Whats going wrong here?
Thanks in advance
Try to test your API at https://your_app_id.appspot.com/_ah/api/tictactoe/v1/ and see if that doesn't do what you want.
Research from this link:https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-android/blob/master/app/src/main/java/com/google/api/services/tictactoe/Tictactoe.java
Lines 60-74
https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-java/blob/master/src/com/google/devrel/samples/ttt/spi/BoardV1.java
Lines 29-31
I suspect you have the API URL wrong, and diving in the code its apparent that the above URL is correct.
No idea where are you getting the instructions for step 4 (in your list), but looking at Setup Instructions in the for the Android project, step 2, what you should do is:
Update the value of DEFAULT_ROOT_URL in src/com/appspot/api/services/tictactoe/Tictactoe.java to point to the location where you are hosting a Tic Tac Toe backend (based off of the Java backend example).
And the location in your case is crearly "https://myappname.appspot.com/".

Bluemix android app .. no applicationId was specified exception

I want to run an android app using bluemix. I followed these steps:
http://www.ibm.com/developerworks/library/mo-android-mobiledata-app/index.html#N10131
But I'm facing an exception saying that the Application ID is not found:
Exception: 07-21 13:03:04.017: E/AndroidRuntime(1776):
java.lang.RuntimeException: Unable to create application
com.ibm.bluelist.BlueListApplication:
com.ibm.mobile.services.core.internal.IBMBluemixException:
IBMBLUEMIX-0042E: Initialization failed because
I have used my own Application ID, secret and route but I'm still getting this error. Can any one please help on this?
Based on the Message ID, I think this is the full error message.
"Initialization failed because no applicationId was specified"
#whitfiea is correct. You need to make sure the AppID is correctly specified for the Mobile Cloud application you are trying to reach (as well as check the other values, the appSecret and the appRoute).
The appRoute should be something like "BlueList.mybulemix.net"
I would also suggested downloading a new set of IBM Client SDK for Android JARs for your project. I would also recommend downloading a new copy of the BlueList sample from JazzHub, as corrections have been made to the application.
One final suggestion, create a new Mobile Cloud Application Backend, just to make sure you are at the current code levels for the client-side and the cloud side.
1.Please try applicationRoute in bluelist.properties file without any prefix like http.
Make sure your application is of type Mobile Cloud under boilerplates.
Verify the below step given in article.
Your Android app will need basic network capability and permissions, so we've included the following permissions in the manifest file. Open up the AndroidManifest.xml file to take a look.
Thanks.

unable to cast to personal whitelisted receiver app

I have successfully used the Android TicTacToe app to cast to the TicTacToe receiver app (AppID "TicTacToe"), using unmodified code from the TicTacToe example on github.
Next, I tried to use my personal receiver app. I got the email a couple of hours letting me know that my device was whitelisted and providing the AppID. I put the AppID in line 90 on GameActivity.java (not line 91, as stated in the instructions), and I also put it in line 35 of tictactoe.html (this step was missing from the instructions, but I assume it is needed). I also followed all steps in the Common Errors section of the instructions.
When I click the Start button in the Android app, the Tic-Tac-Toe board appears in the Android app, but the Chromecast device does not noticeably react.
Here is the LogCat:
07-28 00:13:47.776: W/StartSessionTask(10892): StartApplicationRequest failed with status: -4
07-28 00:13:47.826: E/ApplicationSession(10892): StartSessionTask failed with error: failed to start application: request failed
07-28 00:13:47.826: D/GameActivity(10892): start session failed: failed to start application: request failed
Try checking the box that says "Send this Chromecast's serial number when checking for updates".
Mine didn't work at first, after doing this and restarting mine seemed to pick up the whitelisted appID.
As mentioned by the author of question: Make sure to do from ChromeOS, Windows or Mac OSX client until they fix the issue from Android app.
Clients can be downloaded here: https://cast.google.com/chromecast/setup
This was fixed for me after I restarted the chromecast by removing power.
I tried Aaron's answer several times (was finally able to get the setting to stick using the Chromecast Mac app) but it still was giving this same error.
Then, I discovered I actually uploaded the receiver file to the wrong url. So double check which url was actually whitelisted!
Though even after fixing the url it still was broken. So I think I must have entered the wrong serial number when I made the whitelist request. I resent the whitelist request and the new app ids are working properly.
I solved same problem by using HTTP instead of HTTPS for my local hosted receiver, it seems Chromecast looks for valid certificate.

Categories

Resources