-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using AppPassword for an authentication to outlook.office365.com mail box in .NET #25968
Comments
@bastyuchenko Thank you for your feedback . We will investigate and update the thread accordingly. |
I have tried to use UserPasswordCredential in one of my sample application and I found that if we register our app as (web app or web api), we can not authenticate with username and password. I am not sure if App password can be used this way. App passwords were only created for use with our legacy apps (outlook etc. ) which did not support Modern authentication and could not thus use MFA flow. However I tested it with normal username/password combination. I assume that you already have a application registered through which you are trying out the provided code snippet? We could not find any specific code sample which could suffice your use case as described. Could you please use clientID as a native app client id and let us know if it helps? |
@bastyuchenko Could you please let us know if explanation suggested above worked for you ? |
@shashishailaj |
@bastyuchenko Thank you for quick response. We apologize that the provided information was not useful to you . But app passwords were designed to serve as second factor for Microsoft legacy applications which could not work with MFA as per my knowledge and hence it may not be possible to use in your custom .NET code. |
@bastyuchenko We will close this issue now . Should you have any further queries on this , please tag me to your reply and we can engage in a conversation again . |
I generated AppPassword for my account and want to acquire an access token to authenticate to my mailbox in outlook.office365.com. I tried to use the following code
var _authContext = new AuthenticationContext(authorityFormatString);
_authContext.AcquireTokenAsync("https://graph.windows.net", clientID, new UserPasswordCredential(emailAdress, emailPassword));
It does not work - I receive "Invalid username or password.".
Is it possible to use AppPassword in .NET code?
Could you give me an example of code or a reference to an article with a code example?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: