Closed kgamecarter closed 5 years ago
Thanks for your contribution. I would like to test this first as it really should not be necessary to provide a client secret. Can you provide me with more detailed steps on how to reproduce the issue please?
Create new Azure AD application. Add custom redirect url.
In ASP.NET Core MVC project.
private static OneDriveGraphApi oneDriveApi = new OneDriveGraphApi("4f205cff-965c-4f5e-b867-f5e27721c2db");
public async Task<IActionResult> AuthOneDrive()
{
oneDriveApi.AuthenticationRedirectUrl = "https://localhost:44307/Home/ParseToken";
return Redirect(oneDriveApi.GetAuthenticationUri().AbsoluteUri);
}
public async Task<IActionResult> ParseToken()
{
var url = Microsoft.AspNetCore.Http.Extensions.UriHelper.GetDisplayUrl(Request);
var authToken = oneDriveApi.GetAuthorizationTokenFromUrl(url);
try
{
var token = await oneDriveApi.GetAccessToken();
return RedirectToAction("Index");
}
catch(TokenRetrievalFailedException e) // The request body must contain the following parameter: 'client_assertion' or 'client_secret'.
{ }
return BadRequest();
}
Fix issue #18