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.
There's a third-party Frappe Client for dotnet (available on NuGet) that you can check out: