{"id":1577,"date":"2022-09-30T14:08:09","date_gmt":"2022-09-30T01:08:09","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1577"},"modified":"2022-09-30T14:10:34","modified_gmt":"2022-09-30T01:10:34","slug":"the-resource-owner-password-credential-ropc-grant-type","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1577","title":{"rendered":"The Resource Owner Password Credential (ROPC) Grant Type"},"content":{"rendered":"<p>The resource owner password credential grant type is <strong>designed as a stop-gap for legacy applications<\/strong>. Should only be used temporarily until the migration of the application to OAUTH is complete. This grant type should never be used anymore. This type can request for <strong>offline_access<\/strong> scope <em>(i.e. to request for refresh token)<\/em>.<\/p>\n<ol>\n<li>\n<p>Use the token end point to do <strong>post request for the access token<\/strong> with the following headers:<\/p>\n<pre><code>Content-Type = application\/x-www-form-urlencoded<\/code><\/pre>\n<p>And with the following form data:<\/p>\n<pre><code>grant_type = password\nclient_id = the one used from step 1.\nclient_secret = <CLIENT_SECRET>\nusername = <USERNAME>\npassword = <PASSWORD>\nscope = (Optional) what permision wanted. If not specified, default permission will be given.\nstate = (Optional) value to echo to us.<\/code><\/pre>\n<p><strong>Expected Response<\/strong><\/p>\n<pre><code class=\"language-json\">{\n\"access_token\" : &lt;ACCESS_TOKEN&gt;,\n\"token_type\" : \"Bearer\",\n\"expires_in\" : 3600,\n\"scope\" : &lt;The scope allowed by the server&gt;\n}<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Call the API<\/strong> with the authorization header like the following syntax:<\/p>\n<pre><code>Bearer &lt;ACCESS_TOKEN&gt;<\/code><\/pre>\n<\/li>\n<\/ol>\n<p><strong>Related Post<\/strong><br \/>\n<a href=\"https:\/\/www.ronella.xyz\/?p=1563\" title=\"KEYCLOAK \u2013 JWT GENERATION \u2013 PASSWORD GRANT TYPE\">KEYCLOAK \u2013 JWT GENERATION \u2013 PASSWORD GRANT TYPE<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The resource owner password credential grant type is designed as a stop-gap for legacy applications. Should only be used temporarily until the migration of the application to OAUTH is complete. This grant type should never be used anymore. This type can request for offline_access scope (i.e. to request for refresh token). Use the token end [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[77,23],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1577"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1577"}],"version-history":[{"count":2,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1577\/revisions"}],"predecessor-version":[{"id":1579,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1577\/revisions\/1579"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}