I recently got started with the Microsoft Graph, and as part of it, OAuth. I downloaded an official sample and looking at what they are doing in the code, and there's this part I wasn't really able to understand.
public sealed class SampleAuthProvider : IAuthProvider
{
// Properties used to get and manage an access token.
private string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"];
private string appId = ConfigurationManager.AppSettings["ida:AppId"];
private string appSecret = ConfigurationManager.AppSettings["ida:AppSecret"];
private string scopes = ConfigurationManager.AppSettings["ida:GraphScopes"];
private SessionTokenCache tokenCache { get; set; }
private static readonly SampleAuthProvider instance = new SampleAuthProvider();
private SampleAuthProvider() { }
public static SampleAuthProvider Instance
{
get
{
return instance;
}
}
}
It looks to me that this class is instantiating itself within itself (I'm not sure what I'm saying right now myself). Is it trying to store access token temporarily...? if so what is the point of the instantiation...?