Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Web API App-Only with Graph API
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
You can’t perform that action at this time.