Anti-forgery validation fails when using Azure AD auth -


we implementing html.antiforgerytoken() in our aad authenticated application. login working fine when click button on home page needs call controller action. failing call controller action below exception. idea resolve issue?

error:

[httpantiforgeryexception (0x80004005): provided anti-forgery token meant user "xyz@microsoft.com", current user "".]

html:

using (html.beginform("externallogin", "account", new { returnurl = model.returnurl })) {             @html.antiforgerytoken()             <div id="loginlist">                 <p>                     @foreach (authenticationdescription p in loginproviders) {                         <md-button type="submit" class="btn facebook-theme-background" id="@p.authenticationtype" name="provider" value="@p.authenticationtype" title="log in using @p.caption account">login @p.authenticationtype</md-button>                     }                 </p>             </div>         } 

server side: not entering method. when comment validateantiforgerytoken entering.

    [httppost]         [allowanonymous]         [validateantiforgerytoken]         public actionresult externallogin(string provider, string returnurl)         { } 

using below 2 properties authentication:

    <add key="tenant" value="xyz.onmicrosoft.com" /> <add key="audience" value="<guid>" /> 

i trying reproduce issue, failed. seems issue relative code. can refer code sample works me this link.

if still have problem, may share run-able demo reproducing issue.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -