OAuth2 Authentication

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?

  1. In frappe request. It is used in headers? as Authorization: Bearer {access_token}
  2. It is there in DB as Bearer Token doctype
  3. Pass it from client app, Frappe will validate it
    1. if invalid, it will not set the frappe.session.user
    2. if valid, it will set frappe.session.user from token.

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