Useful frappe features for your random purposes
$ bench get-app https://github.com/leam-tech/frappe_util_configs
You dont have to install this app in any frappe site. Please follow the sections below to make use of those features
JSON WebToken are easy to work with compared to Session Cookies. We present you JWT Support in frappe.
-
To start using this, please run the following:
$ bench frappe-util-configs init
This command will update the
config/supervisor.conf
to usefrappe_util_configs.app:application
as gunicorn entry point and replaces defaultfrappe/socket.io
withfrappe_util_configs/socket.io
-
To obtain a token, pass
use_jwt: 1
along with email and passwordPOST /api/method/login { "usr": "administrator", "pwd": "my-pwd", "use_jwt": 1 }
You will get the token in the response
-
To use the token, pass it in
Authorization
headerPOST /api/method/frappe.auth.get_logged_user Authorization: JWT <token>
Cross Origin Resource Sharing might be required when you have custom applications running To have the CORS headers available in production mode, run
$ bench frappe-util-configs nginx
MIT