Skip to content

Instantly share code, notes, and snippets.

@maisarissi
Last active February 8, 2023 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maisarissi/3ddc2c8269e6e4a8f13838373fe7751e to your computer and use it in GitHub Desktop.
Save maisarissi/3ddc2c8269e6e4a8f13838373fe7751e to your computer and use it in GitHub Desktop.
msgraph-dotnet-v5-rc-custom-auth-flow
public class TokenProvider : IAccessTokenProvider
{
public Task<string> GetAuthorizationTokenAsync(Uri uri,
Dictionary<string,
object> additionalAuthenticationContext = default,
CancellationToken cancellationToken = default)
{
var token = "token";
//get the token and return it in your own way
return Task.FromResult(token);
}
public AllowedHostsValidator AllowedHostsValidator {get;}
}
var accessTokenProvider = new BaseBearerTokenAuthenticationProvider(new TokenProvider());
var graphServiceClient = new GraphServiceClient(accessTokenProvider);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment