azure active directory - AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided -
when trying create authentication header using below code. getting error saying "aadsts70002: error validating credentials. aadsts50012: invalid client secret provided." now, sure, secret used in code not matching 1 used in aad app registration. can me on how client secret, app registrations or how add new application identifier in o365 account directory.
private string getauthenticationheader(authenticationinformation authenticationinformation){ try{ return retryhelper.invokewithretries(() => { var clientcredential = new clientcredential(authenticationinformation.clientid, authenticationinformation.appsecret); var ac = new authenticationcontext(authenticationinformation.authority); authenticationresult ar = ac.acquiretoken(authenticationinformation.resource, clientcredential); return ar.createauthorizationheader(); }); } catch (exception ex){ return ex.message; } }
to add secret key web application's credentials, click "keys" section settings
blade of azure ad app in azure portal :
- add description key , select either 1 or 2 or year duration(or never expires).
- the right-most column contain key value, after save configuration changes. sure come section , copy after hit save, have use in client application during authentication @ run-time.
please click here more details how register , update application azure active directory tenant .
Comments
Post a Comment