/// <summary>Constructs a new flow using the initializer's properties.</summary> public AuthorizationCodeFlow(OAuth2Context initializer) { _ = initializer; if (_.ClientSecrets == null || _.DataStore == null) { throw new ArgumentException("You MUST set ClientSecret and DataStore on the initializer"); } }
static void Main(string[] args) { var ctx = new OAuth2Context(AzureConsts.AuthorizationServerUrl, AzureConsts.TokenServerUrl, AzureConsts.RedirectUrl) { ClientSecrets = AzureSecrets, DataStore = new FileDataStore("oauthdemo"), // Scopes = new[] { "https://api.datamarket.azure.com/" },// sohu require basic scope }; var broker = new WebAuthorizationBroker(ctx); var resp = broker.AuthorizeAsync("default", true, CancellationToken.None).Result; }
public WebAuthorizationBroker(OAuth2Context c) { flow = new AuthorizationCodeFlow(c); }