Web API App-Only with Graph API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrganisationController : Controller | |
{ | |
... | |
public OrganisationController(IOptions<GraphApp> graphApp) | |
{ | |
this._graphApp = graphApp.Value; | |
this.Init(); | |
} | |
... | |
private void Init() | |
{ | |
var tenant = this._graphApp.Tenant; | |
var authUrl = this._graphApp.AuthUrl; | |
var authority = string.Format(authUrl, tenant); | |
this._authContext = new AuthenticationContext(authority); | |
var clientId = this._graphApp.ClientId; | |
var clientSecret = this._graphApp.ClientSecret; | |
this._credential = new ClientCredential(clientId, clientSecret); | |
this._graphUrl = this._graphApp.GraphUrl; | |
this._version = this._graphApp.Version; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment