Search code examples
azurexamarin.formsadalo365-flow

Trying O365 Authentication in Xamarin forms app


We are new to O365 Authentication and trying to authenticate the user.

Here i am getting this error while trying to login with, office 365.

Create app in active directory add app id and return urls in app, and this is the document I followed, https://blog.xamarin.com/put-adal-xamarin-forms/

here is the error we are getting,

AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion' Trace ID: e580114e-2dd9-4cc4-b903-6cef743a2900 Correlation ID: 6e58ff9d-bea4-4ad3-9fe3-e27c92fc9597 Timestamp: 2018-12-05 12:51:23Z

{System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized). ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException: {"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'\r\nTrace ID: e580114e-2dd9-4cc4-b903-6cef743a2900\r\nCorrelation ID: 6e58ff9d-bea4-4ad3-9fe3-e27c92fc9597\r\nTimestamp: 2018-12-05 12:51:23Z","error_codes":[70002],"timestamp":"2018-12-05 12:51:23Z","trace_id":"e580114e-2dd9-4cc4-b903-6cef743a2900","correlation_id":"6e58ff9d-bea4-4ad3-9fe3-e27c92fc9597"}: Unknown error --- End of inner exception stack trace ---}


Solution

  • Ok ,Maybe you have registered your app as a confidential client (web app or web api).

    You cannot authenticate with username and password when the app is a confidential client. Only public clients, sometimes known as native clients, can do U/P authentication.

    Trying to Change to native client.

    Refer to this link to try