microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet
Fido2Methods.CreationOptionsWithChallengeTimeoutInMinutes not working
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 112
- Forks
- 37
- Avg merge
- 14h 57m
- Merged PRs (30d)
- 3
Description
Describe the bug
Hi,
I'm unable to call a request on CreationOptionsWithChallengeTimeoutInMinutes due an error in the SDK. It forcess us to set ChallengeTimeoutInMinutes but it still does not work.
By the docs / graph explorer usage its should not required.
If I do not set the parameter, it crashes
var response = await client.GraphService.Users[externalUserId]
.Authentication.Fido2Methods.CreationOptionsWithChallengeTimeoutInMinutes
.GetAsync();
If I set the parameter, it crashes
var response = await client.GraphService.Users[externalUserId]
.Authentication.Fido2Methods.CreationOptionsWithChallengeTimeoutInMinutes
.GetAsync(r =>
{
r.Options.WithAppOnly();
r.QueryParameters.ChallengeTimeoutInMinutes = 5;
});
Thank you,
Expected behavior
The request should work with and without challange in minutes being set.
How to reproduce
Use the code I've attached and try the request.
SDK Version
5.88.0-preview
Latest version known to work for scenario above?
No response
Known Workarounds
- Copy the contents of generated code
- Remove code that sets path
(challengeTimeoutInMinutes=@challengeTimeoutInMinutes){?challengeTimeoutInMinutes*} - Run the request
var requestBuilder = client.GraphService.Users[externalUserId].Authentication.Fido2Methods;
var creationOptionsBuilder = new CreationOptionsBuilder(
(requestBuilder.ToGetRequestInformation().PathParameters as Dictionary<string, object>)!,
client.GraphService.RequestAdapter
);
var response = await creationOptionsBuilder.GetAsync();
Debug output
Click to expand log
Microsoft.Graph.Beta.Models.ODataErrors.ODataError: {"Message":"An error has occurred.","ExceptionMessage":"Missing the value of the parameter 'challengeTimeoutInMinutes' in the function 'creationOptions' calling.","ExceptionType":"System.InvalidOperationException","StackTrace":" at Microsoft.AspNet.OData.Routing.ODataPathSegmentHandler.TranslateNode(Object node, String functionName, String parameterName)\r\n at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)\r\n at
Configuration
- OS: Mac, Apple sillicon
Other information
Code i "created"
namespace MicrosoftGraph.Requests;
#pragma warning disable CS0618
using Microsoft.Kiota.Abstractions.Serialization;
using Microsoft.Kiota.Abstractions;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using System;
/// <summary>
/// Provides operations to call the creationOptions method.
/// Until https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet/issues/940
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class Fido2CreationOptionsBuilder : BaseRequestBuilder
{
/// <summary>
/// Instantiates a new <see cref="Fido2CreationOptionsBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public Fido2CreationOptionsBuilder(Dictionary<string, object> pathParameters,
IRequestAdapter requestAdapter) : base(requestAdapter,
"{+baseurl}/users/{user%2Did}/authentication/fido2Methods/creationOptions",
pathParameters)
{
}
/// <summary>
/// Instantiates a new <see cref="Fido2CreationOptionsBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public Fido2CreationOptionsBuilder(string rawUrl, IRequestAdapter requestAdapter) :
base(requestAdapter,
"{+baseurl}/users/{user%2Did}/authentication/fido2Methods/creationOptions",
rawUrl)
{
}
/// <summary>
/// Retrieve creation options required to generate and register a Microsoft Entra ID-compatible passkey. Self-service operations aren't supported.
/// Find more info here <see href="https://learn.microsoft.com/graph/api/fido2authenticationmethod-creationoptions?view=graph-rest-beta" />
/// </summary>
/// <returns>A <see cref="global::Microsoft.Graph.Beta.Models.WebauthnCredentialCreationOptions"/></returns>
/// <param name="cancellationToken">Cancellation token to use when cancelling requests</param>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
/// <exception cref="global::Microsoft.Graph.Beta.Models.ODataErrors.ODataError">When receiving a 4XX or 5XX status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task<global::Microsoft.Graph.Beta.Models.WebauthnCredentialCreationOptions?> GetAsync(
Action<RequestConfiguration<global::Microsoft.Graph.Beta.Users.Item.Authentication.Fido2Methods.
CreationOptionsWithChallengeTimeoutInMinutes.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder.
CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters>>? requestConfiguration =
default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task<global::Microsoft.Graph.Beta.Models.WebauthnCredentialCreationOptions> GetAsync(Action<RequestConfiguration<CreationOptionsBuilder.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters>> requestConfiguration
= default, CancellationToken cancellationToken = default)
{
#endif
var requestInfo = ToGetRequestInformation(requestConfiguration);
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>>
{
{ "XXX", global::Microsoft.Graph.Beta.Models.ODataErrors.ODataError.CreateFromDiscriminatorValue },
};
return await RequestAdapter.SendAsync<global::Microsoft.Graph.Beta.Models.WebauthnCredentialCreationOptions>(
requestInfo,
global::Microsoft.Graph.Beta.Models.WebauthnCredentialCreationOptions.CreateFromDiscriminatorValue,
errorMapping, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Retrieve creation options required to generate and register a Microsoft Entra ID-compatible passkey. Self-service operations aren't supported.
/// </summary>
/// <returns>A <see cref="RequestInformation"/></returns>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToGetRequestInformation(
Action<RequestConfiguration<global::Microsoft.Graph.Beta.Users.Item.Authentication.Fido2Methods.
CreationOptionsWithChallengeTimeoutInMinutes.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder.
CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters>>? requestConfiguration =
default)
{
#nullable restore
#else
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<CreationOptionsBuilder.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters>> requestConfiguration
= default)
{
#endif
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
requestInfo.Headers.TryAdd("Accept", "application/json");
return requestInfo;
}
/// <summary>
/// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
/// </summary>
/// <returns>A <see cref="Fido2CreationOptionsBuilder"/></returns>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
public global::Microsoft.Graph.Beta.Users.Item.Authentication.Fido2Methods.
CreationOptionsWithChallengeTimeoutInMinutes.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder
WithUrl(string rawUrl)
{
return new global::Microsoft.Graph.Beta.Users.Item.Authentication.Fido2Methods.
CreationOptionsWithChallengeTimeoutInMinutes.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder(
rawUrl, RequestAdapter);
}
/// <summary>
/// Retrieve creation options required to generate and register a Microsoft Entra ID-compatible passkey. Self-service operations aren't supported.
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters
{
}
/// <summary>
/// Configuration for the request such as headers, query parameters, and middleware options.
/// </summary>
[Obsolete(
"This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")]
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetRequestConfiguration :
RequestConfiguration<global::Microsoft.Graph.Beta.Users.Item.Authentication.Fido2Methods.
CreationOptionsWithChallengeTimeoutInMinutes.CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder.
CreationOptionsWithChallengeTimeoutInMinutesRequestBuilderGetQueryParameters>
{
}
}
#pragma warning restore CS0618
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CreationOptionsWithChallengeTimeoutInMinutesRequestBuilder.cs and the generated Fido2CreationOptionsBuilder code included in the issue. Reproduce the GET request with and without ChallengeTimeoutInMinutes, then compare the generated request details with the documented Graph Explorer usage. Done means the SDK request succeeds in both cases without requiring the reported manual workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100