Skip to content

Adds MSAL-Graph auth provider support. #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2019
Merged

Conversation

peombwa
Copy link
Member

@peombwa peombwa commented Mar 16, 2019

This PR adds autorization code provider support to handle access token retreival and storage.

// Create session token provider
SessionTokenCacheProvider sessionTokenCacheProvider = new SessionTokenCacheProvider(httpContext);

// Create confidential client application
IConfidentialClientApplication cca = AuthorizationCodeProvider.CreateClientApplication(appId, redirectUri, new ClientCredential(appSecret), sessionTokenCacheProvider);

// Pass authorization code provider to GraphServiceClient
GraphServiceClient graphClient = new GraphServiceClient(new AuthorizationCodeProvider(cca, scopes));

// Make graph request
var me = await graphClient
.Me
.Events
.Request()
.WithUserAccount(ClaimsPrincipal.Current.ToGraphUserAccount())
.GetAsync();

@peombwa peombwa requested a review from darrelmiller March 16, 2019 02:52
@darrelmiller darrelmiller merged commit 552d1ee into master Mar 30, 2019
@jasonjoh jasonjoh deleted the po/msalAuthProvider branch May 26, 2020 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants