How to sign in office 365 email programatically using o365 api client librarary c# code

I'm integrating an web application with office 365 email using o365 api client library.

I want to sign in using the c# code not by showing the Microsoft UI sign in page(

If I provide username/password for an user and if the username/password is correct then it should authenticate the user to see the office 365 mails of the web application.

Thanks in advance.


The purpose of OAUTH is to protect both your and your users. As soon as you get into the business of storing credentials, you own responsibility for securing those credentials.

I assume you are looking to access a user's data via a backend process. This workflow requires the "offline_access" scope. Offline does not mean "disconnected from the internet" but rather that the end-user is "offline" from your app (not able to interact with a UX).

You should be executing an OAUTH Code Grant workflow and adding "openid" and "offline_access" to your scopes. This will give you both an id_token that can be used to hit the Office APIs as well as a refresh_token that you can use to get a new id_token when the existing token expires. Refresh tokens can be used even if the end-user is off line (there is no UX involved).

Once you have an id_token and refresh_token, you can use these values to interact with O365 on the end-user's behalf. A common example would be syncing calendars. The first time a user will need to authenticate and configure (i.e. which calendars do they want to sync). From then on, your sever uses the id_token and refresh_token to operate without the user being online (this the term "offline_access").

Need Your Help

Debugging an Android app in Eclipse using the handset

android eclipse debugging mobile

I am just starting to learn Android development using the Android SDK and Eclipse. I can get my HelloWorld starting app to run in the device emulator, but not on my Verizon Droid handset. I have

Can I setup my own SMS WEBSITE. How?

php web sms sms-gateway

I'm new to this site, and also i am not a super coder, so please have some patience with me, another thing is that i have a really small bandwidth, so please if you could send me an email it would be