-1

I need your help in one of my project requirement.

My requirement is to send mail from our .net Application. So when user want to send mail then first the user should be redirected to the microsoft sign-in page (e.g https://login.microsoftonline.com/login.srf ) where the user can enter the corporate credential and from there after successful login it should return a token. Then from that token we need to retrieve the user's mailid.

Then we can pass that mailid along with the Token to generate the oAuth object and then authenicate that Oauth object and then after successful authentication we can send mail.

Below links are giving me some idea but I am not sure how to redirect user to sign-in page and after successful sign-in how to capture the Token.

SMTP and OAuth 2

https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md

Any kind help is greatly appreciated. Any sample code will be of great help.

Sunil M
  • 1
  • 2
  • Without meaning to be rude, authentication is not something that you should be asking about on SO. If this is part of a project, is there not a senior person who can make sure you implement this properly? If you do understand OAuth2 then please rephrase your question to be more specific to the problem you are having. – Luke Briner Sep 16 '21 at 14:24

1 Answers1

0

When an OAuth flow is set up for authorization, one of the parameters is the redirect_uri. That URI manages the exchange of a code for OAuth tokens. The code behind that URI would capture the tokens, process email, redirect the user, and anything else you require.

OAuth Redirect URIs

Azure Redirect URI (reply URL) restrictions and limitations

John Hanley
  • 74,467
  • 6
  • 95
  • 159