Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error when i get any doc or get current user details after login #46

Open
arsal-786 opened this issue Jan 4, 2024 · 2 comments
Open
Assignees

Comments

@arsal-786
Copy link

arsal-786 commented Jan 4, 2024

Describe the bug
Login successfully but after that its show error on any request
To Reproduce
Steps to reproduce the behavior:

import { FrappeApp} from "frappe-js-sdk";
export const frappe = new FrappeApp("https://localhost...")
on login page

const auth = frappe.auth()
const response = await auth.loginWithUsernamePassword({ username, password})
give me response
{
"message": "Logged In",
"home_page": "/app",
"full_name": "Arslan Jameel"
}
after that when i get Logged In User details its show error below
{
"exc_type": "PermissionError",
"exception": "frappe.exceptions.PermissionError:

You are not permitted to access this resource.Function frappe.auth.get_logged_user is not whitelisted.
",
"exc": "["Traceback (most recent call last):\n File \"apps/frappe/frappe/app.py\", line 66, in application\n response = frappe.api.handle()\n File \"apps/frappe/frappe/api.py\", line 55, in handle\n return frappe.handler.handle()\n File \"apps/frappe/frappe/handler.py\", line 38, in handle\n data = execute_cmd(cmd)\n File \"apps/frappe/frappe/handler.py\", line 73, in execute_cmd\n is_whitelisted(method)\n File \"apps/frappe/frappe/init.py\", line 756, in is_whitelisted\n throw(msg, PermissionError, title=\"Method Not Allowed\")\n File \"apps/frappe/frappe/init.py\", line 505, in throw\n msgprint(\n File \"apps/frappe/frappe/init.py\", line 480, in msgprint\n _raise_exception()\n File \"apps/frappe/frappe/init.py\", line 435, in _raise_exception\n raise raise_exception(msg)\nfrappe.exceptions.PermissionError:
You are not permitted to access this resource.Function frappe.auth.get_logged_user is not whitelisted.
\n"]",
"_server_messages": "["{\"message\": \"
You are not permitted to access this resource.Function frappe.auth.get_logged_user is not whitelisted.
\", \"title\": \"Method Not Allowed\", \"indicator\": \"red\", \"raise_exception\": 1}"]",
"httpStatus": 403,
"httpStatusText": "",
"message": "There was an error while fetching the logged in user"
}

Environment (please complete the following information):

  • OS: fedora 38
  • Browser Firefox
  • SDK frappe-js-sdk
  • Nextjs 14
@sek-MiraiMinds
Copy link

@arsal-786 Did you fetch any problem related error code 404 not found when trying to authenticate or get any document list using this library ?

@chechani
Copy link

chechani commented Apr 6, 2024

We got a similar error and created issue #55 , it says get_logged_in_user in frappe auth.py is not a whitelisted function, and it does not allow access to recently logged in user and then return an error for unauthorised

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants