public IActionResult DeviceCodeV1_Ask([FromForm] DeviceCodeAskV1 input) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(StatusCode((int)HttpStatusCode.NotImplemented)); }
public async ValueTask <DeviceCodeV1> DeviceCode_AskV1(DeviceCodeAskV1 model) { var response = await Endpoints.DeviceCode_AskV1(model); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <DeviceCodeV1>().ConfigureAwait(false)); } throw new HttpRequestException(response.RequestMessage.ToString(), new Exception(response.ToString())); }
/* * https://oauth.net/2/grant-types/device-code/ */ public async ValueTask <HttpResponseMessage> DeviceCode_AskV1(DeviceCodeAskV1 model) { var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("issuer_id", model.issuer_id), new KeyValuePair <string, string>("client_id", model.client_id), new KeyValuePair <string, string>("grant_type", model.grant_type), new KeyValuePair <string, string>("username", model.username), }); return(await _http.PostAsync("oauth2/v1/dcg-ask", content)); }