How to get the email message from the microsoft live.com

163 views Asked by At

I have a strange requirement.

I have to first allow the user to register through the outlook email and allow the offline acces to their email using the oauth and then use these oauth token to read email from outlook/microsoft live using php from my web-application and store the data in the database. so is there any way to do this ?

it need to work well in all major browsers.

Thanks.

1

There are 1 answers

3
Ed Knowles On

What you are after is a way to authenticate a Microsoft account with your server.

In doing so you can use Microsoft APIs to get emails and other data from the users account.

Here is a library for PHP which will guide you through the flow. https://github.com/stevenmaguire/oauth2-microsoft

You will need two things, first register an app with microsoft to get a clientId and clientSecret, then in the flow make sure you request access to the users email with the following permissions.

$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['wl.basic', 'wl.signin', 'wl.emails', 'wl.imap'] // array or string
];