Partner-Center-DotNet-Samples
Partner-Center-DotNet-Samples copied to clipboard
Not able fetch refresh token
Steps to reproduce
we have set all the information about the ad profile such as CSPAplication Id ,CSPApplicationSecret. when we try to login after set up values, it throw error for secret are not found at time of SetSecretAsync call. we try to run partner consent application to set refreshed token in key vault. we are using app only authentication in one of the tenants of our domains.
What steps can reproduce the defect?
- Asp.net core 3.1 C#
- region Assembly Microsoft.Azure.KeyVault, Version=3.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
- Method signature public static Task<SecretBundle> SetSecretAsync(this IKeyVaultClient operations, string vaultBaseUrl, string secretName, string value, IDictionary<string, string> tags = null, string contentType = null, SecretAttributes secretAttributes = null, CancellationToken cancellationToken = default);
Expected behavior
we get a refresh token for the defined user of azure portal for for given app managed key and corelated app registration client Id successfully.
Share the expected output
Actual behavior
please find the attached screen shot not found as above.
What is the behavior observed?
Diagnostic logs
at Microsoft.Azure.KeyVault.KeyVaultClient.<GetSecretWithHttpMessagesAsync>d__66.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.KeyVault.KeyVaultClientExtensions.<GetSecretAsync>d__12.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Application.Services.KeyVaultProvider.<GetSecretAsync>d__11.MoveNext() in D:\Projects\ClientApp\Src\Services\Application\Services\KeyVaultProvider.cs:line 51
Environment
azure cloud visual studio IDE
Im having the same problem.
Probably the procedure is not quite comprehensible for me. The code in CSPApplication
demo seems to assume that the refresh token is already in the key vault?
There also seems not to be any form of initial login procedure within the CSPApplication
demo?
@krunaldave24 i found my confusion and got it to work following https://github.com/microsoft/Partner-Center-DotNet-Samples/issues/45#issuecomment-737242542
You have to run the constent-web-sample first which will create the necessary secret within the key vault.
After that the CSPApplication
demo works if you fix this problem: https://github.com/microsoft/Partner-Center-DotNet-Samples/issues/55