public void GetTokenTest() { // TODO uncomment below to test the method and replace null with proper value string grantType = "authorization_code"; string clientId = "4dp5b7gRqk"; string code = "novp2e"; string clientSecret = "fa3a5b16753d09b24bb44243605a4a98"; string refreshToken = null; int? platform = 2; var response = instance.GetToken(grantType, clientId, code, clientSecret, refreshToken, platform); Assert.IsInstanceOf <InlineResponse200> (response, "response is InlineResponse200"); }
// step 5 public ActionResult RefreshAccessToken(Demo InputModel) { var SavedModel = _context.Demos.SingleOrDefault(d => d.Id == InputModel.Id); SavedModel.ClientId = InputModel.ClientId; SavedModel.ClientSecret = InputModel.ClientSecret; SavedModel.GrantType = InputModel.GrantType; SavedModel.RefreshToken = InputModel.RefreshToken; try { RetrievingRefreshingApi instance = new RetrievingRefreshingApi(); var response = instance.GetToken(grantType: SavedModel.GrantType, clientId: SavedModel.ClientId, clientSecret: SavedModel.ClientSecret, refreshToken: SavedModel.RefreshToken); SavedModel.Step5Response = response.ToJson(); } catch { SavedModel.Step5Response = Demo.RefreshErrorResponse; } _context.SaveChanges(); return(View("Index", SavedModel)); }