Answered by:
Issue with AcquireTokenAsync while working with Graph API

Question
-
I am working on an application to check if a particular User is present in an Active Directory group or not.
I am using the following code:
var authContext = new AuthenticationContext(authority); ClientCredential clientCredential = new ClientCredential(clientId, appKey); string token = ""; try { var authresult = await authContext.AcquireTokenAsync("https://graph.windows.net", clientCredential); token = authresult.AccessToken; }
This is always giving me an Invalid Client Secret Key error despite giving correct values for any newly created app.
However, If I try with an older secret key it is giving me correct results.
Could it be a case where newly created ClientKeys take some time to replicate?
- Moved by Mike Laughlin Wednesday, June 29, 2016 3:22 PM From 'Forums Issues' - not reporting an issue with the forums.
Wednesday, June 29, 2016 3:21 PM
Answers
-
You might try them here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Mike Laughlin Wednesday, June 29, 2016 5:46 PM
- Marked as answer by Dave PatrickMVP Sunday, July 10, 2016 9:52 PM
Wednesday, June 29, 2016 5:42 PM -
Hello,
If this is for the Azure AD Graph API, Microsoft Azure forums are over here:
https://social.msdn.microsoft.com/forums/azure/en-US/home
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})- Proposed as answer by Mike Laughlin Thursday, June 30, 2016 11:59 AM
- Marked as answer by Dave PatrickMVP Sunday, July 10, 2016 9:52 PM
Wednesday, June 29, 2016 9:19 PM
All replies
-
You might try them here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Mike Laughlin Wednesday, June 29, 2016 5:46 PM
- Marked as answer by Dave PatrickMVP Sunday, July 10, 2016 9:52 PM
Wednesday, June 29, 2016 5:42 PM -
Hello,
If this is for the Azure AD Graph API, Microsoft Azure forums are over here:
https://social.msdn.microsoft.com/forums/azure/en-US/home
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})- Proposed as answer by Mike Laughlin Thursday, June 30, 2016 11:59 AM
- Marked as answer by Dave PatrickMVP Sunday, July 10, 2016 9:52 PM
Wednesday, June 29, 2016 9:19 PM