Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with implementing Office 365 API on Android (Xamarin)

I am trying to get this application running as a starting point. https://medium.com/xamarin-development/integrating-office-365-into-xamarin-apps-f9a33e5c73b1. I setup a trial account, entered the client ID, etc. When I try to enter credentials to login to my work Office 365 account or a separate outlook.com account, I get the following error in the debug output,

Refused to execute script from 'https://directory.services.live.com***' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

I'm not sure what this is supposed to do for the page, but it is definitely a function call and I assume it needs to happen to keep things moving.

SetTileUrl({"Views":[{"Id":{"Cid":"0x********","Puid":null},"Attributes":[]}],"TraceGraph":null});

Onscreen, the MS login page just says

"Sorry, but we're having trouble signing you in. We received a bad request."

More debugging and stepping through shows that I never get an access token to continue with.

I've been fighting with this for a quite a while, has anyone else been able to get this code working or seen this problem?

like image 829
Dave_750 Avatar asked Aug 11 '17 18:08

Dave_750


1 Answers

Based on what you say i would assume, the steps you need to do are the following:

  1. Create an azure subscription. (https://azure.microsoft.com/de-de/free/)
  2. Go to https://manage.windowsazure.com/
  3. Here you need to add the app to get access like pointed out in the article you linked. A tutorial how to add your app is here https://developer.xamarin.com/guides/cross-platform/azure/active-directory/getting-started/register/
  4. When you added the app you get a client id which you can use in the demo application. The id should like this e2e6c326-03aa-4c47-8fde-86s23834e3ad and you can change it in the StartupPage.cs at LoginButton_Clicked.

That is basically the thing i did to get it to work.

If you need further help on the topic, feel free to ask.

like image 152
Cyriac Avatar answered Nov 15 '22 16:11

Cyriac