I need help implementing OAuth2 for use via an API in frappe. I have already set up Auth Client, but am not sure how this connects using an API. Who has implemented this before? @revant_one
check if this helps, it has sample code in typescript for angular
I didn’t manage to get this working Sir. Maybe I re-frame my question like this, How do I get the Bearer Token (access_token) in Frappe?
In frappe?
- In frappe request. It is used in headers? as
Authorization: Bearer {access_token}
- It is there in DB as
Bearer Token
doctype - Pass it from client app, Frappe will validate it
- if invalid, it will not set the
frappe.session.user
- if valid, it will set frappe.session.user from token.
- if invalid, it will not set the
edit:
How to get token from frappe?
Use authorization code flow, make sure CORS for client’s url is enabled if the client is browser app. More about frappe https://frappeframework.com/docs/v13/user/en/guides/integration/rest_api/oauth2