REST call from Xamarin -


i'm trying access rest web service on azure xamarin forms application. have app registration authentication, unable authenticate web service defined in different app registration. i've tried passing token on request, no luck. strikes me should possible , must missing obvious, have example of this?

this code allows me authenticate , populates authresult expected , tries call web service passing accesstoken in. authentication work 401 on web service call, if call web service browser can login , view it.

authenticationcontext authcontext = new authenticationcontext("https://login.windows.net/acme.onmicrosoft.com"); authenticationresult authresult = await authcontext.acquiretokenasync("https://graph.windows.net", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", new system.uri("http://my-authentication-redirect"), new platformparameters(this)); httpclient client = new httpclient(); client.defaultrequestheaders.authorization = new authenticationheadervalue("bearer", authresult.accesstoken); string result = client.getstringasync("http://acme-mobileapp.azurewebsites.net/api/values/data").result; 


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -