public ActionResult CreateClient([FromQuery] string id, [FromQuery] string secret, [FromQuery] string[] scopes) { try { Client client = new Client() { ClientId = id, ClientSecrets = { new Secret(secret.Sha256()) }, AllowedGrantTypes = GrantTypes.ClientCredentials, AllowedScopes = scopes }; clientsService.Add(client); } catch (Exception) { return(BadRequest("Invalid request. Client was not created")); } return(Ok()); }
public ActionResult <ClientCredentials> Post([FromBody] ClientCredentials credentials) { if (credentials != null) { studentsAPIClients.Add(new Client() { ClientId = credentials.ClientId, ClientSecrets = new List <Secret> { new Secret(credentials.ClientSecret.Sha256()) }, AllowedScopes = new List <string> { credentials.Scope } }); } return(Ok()); }