0

I'm trying to connect to frappeframework using ASP.Net MVC.

I must use "Password Based Auth" like stated in number 2 here : https://frappeframework.com/docs/v14/user/en/api/rest

I call rest API for login successfully, but my problem comes after this. I cannot call another API like "http://{url}/api/resource/Items" because it says Insufficient Permission

Seems it needs to store the cookie and session. I tried to use CookieContainer:

CookieContainer cookieJar = new CookieContainer();
foreach (var item in cookies)
{
    HttpCookie cookie = new HttpCookie(item.Name, item.Value);
    cookie.Expires = item.Expires;
    Response.Cookies.Add(cookie);
} 
foreach (var cookieHeader in response.Headers.GetValues("Set-Cookie"))
{                                 
    cookieJar.SetCookies(baseAddress, cookieHeader);
}
return View();

but i cannot find any cookie set in my browser. and call other API still return me Insufficient Permission.

Please help how to resolve my issue since i still confuse how to use this cookie container. Also how to use the cookie for my future API call.

Oscar
  • 33
  • 3

1 Answers1

0

There's a third-party Frappe Client for dotnet (available on NuGet) that you can check out:

https://github.com/yemikudaisi/FrappeRestClient.Net

gavin
  • 793
  • 1
  • 7
  • 19
  • I don't do dotnet development but I do maintain an awesome list to track all things Frappe on [GitHub](https://github.com/gavindsouza/awesome-frappe). Happened to find this library while scouring the internet. Hope this helps. – gavin Feb 28 '23 at 08:17