# Using OAuth Once the client and provider settings are entered, following steps can be used to start using OAuth 2.0 ### Authorization Code Endpoint #### Authorization Request URL: ``` [GET] 0.0.0.0:8000/api/method/frappe.integrations.oauth2.authorize ``` Params: ``` client_id = scope = response_type = "code" redirect_uri = ``` #### Confirmation Dialog Click 'Allow' to receive authorization code in redirect uri. ``` http://localhost:3000/oauth_code?code=plkj2mqDLwaLJAgDBAkyR1W8Co08Ud ``` If user clicks 'Deny' receive error ``` http://localhost:3000/oauth_code?error=access_denied ``` ### Token Endpoints #### Get Access Token URL: ``` [POST] 0.0.0.0:8000/api/method/frappe.integrations.oauth2.get_token ``` Params: ``` grant_type = "authorization_code" code = redirect_uri = client_id = ``` Response: ``` { "access_token": "pNO2DpTMHTcFHYUXwzs74k6idQBmnI", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "cp74cxbbDgaxFuUZ8Usc7egYlhKbH1", "scope": "project" } ``` #### Refresh Access Token URL: ``` [POST] 0.0.0.0:8000/api/method/frappe.integrations.oauth2.get_token ``` Params: ``` grant_type = "refresh_token" refresh_token = redirect_uri = client_id = ``` Response: ``` { "access_token": "Ywz1iNk0b21iAmjWAYnFWT4CuudHD5", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "PNux3Q8Citr3s9rl2zEsKuU1l8bSN5", "scope": "project" } ``` #### Revoke Token Endpoint URL: ``` [POST] 0.0.0.0:8000/api/method/frappe.integrations.oauth2.revoke_token ``` Params: ``` token = ``` Success Response ``` status : 200 {"message": "success"} ``` Error Response: ``` status : 400 {"message": "bad request"} ``` ### Accessing Resource Add header `Authorizaton: Bearer ` to Frappé's REST API endpoints to access user's resource