{"componentChunkName":"component---src-pages-markdown-remark-fields-slug-js","path":"/engineering/using-m2m-authorization-for-apis-and-apps/","result":{"data":{"markdownRemark":{"id":"c70129fd-4709-5c3c-8cef-506212098a48","excerpt":"There are many use cases of a system where machine-to-machine (M2M) communication is required, or you need to manage access for internal and external APIs. The…","html":"<p>There are many use cases of a system where machine-to-machine (M2M) communication is required, or you need to manage access for internal and external APIs. The example of M2M communications are:</p>\n<ul>\n<li>Service to service</li>\n<li>Daemon to backend</li>\n<li>CLI client to internal service</li>\n<li>IoT tools authorization</li>\n<li>External APIs authorization</li>\n</ul>\n<p>In such cases, the generic authentication methods such as email/password and social login — requiring human intervention — don’t fit well. These interactions also need a secure and easy-to-use authorization process for permission-based data access.</p>\n<p>M2M Authorization fulfills both these requirements. Let’s know more about what it is and how it works.</p>\n<h2 id=\"what-is-m2m-authorization\" style=\"position:relative;\"><a href=\"#what-is-m2m-authorization\" aria-label=\"what is m2m authorization permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is M2M Authorization?</h2>\n<p>M2M Authorization is the process of providing remote systems with secure access to information. Using this process, business systems can communicate autonomously and execute business functions based on predefined authorization.</p>\n<p>It is exclusively used for scenarios in which a business system authenticates and authorizes a service rather than a user.</p>\n<p>LoginRadius M2M Authorization uses the <a href=\"#client-credentials-grant-flow\">Client Credentials Grant Flow</a> (defined in OAuth 2.0 RFC 6749), in which the client passes along secure credentials to authenticate themselves and receive an authorization token.</p>\n<h2 id=\"how-loginradius-m2m-authorization-works\" style=\"position:relative;\"><a href=\"#how-loginradius-m2m-authorization-works\" aria-label=\"how loginradius m2m authorization works permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How LoginRadius M2M Authorization Works</h2>\n<p>Suppose an organization has a microservices environment consisting of multiple services running locally. The organization also has data storage on a different network and requires:</p>\n<ul>\n<li>One service to archive data to that storage at regular intervals</li>\n<li>Another service to read data from that storage at regular intervals</li>\n</ul>\n<p>As a standard process and security measure, services require authorization while saving and reading the data to and from the storage. The organization can use LoginRadius for autonomous authorization by creating two dedicated M2M apps with write and read permissions.</p>\n<p>The following two scenarios explain how you can use LoginRadius M2M Authentication and Authorization to share permission-based access of APIs to any internal or external systems:</p>\n<blockquote>\n<p><strong>Important:</strong> M2M App referred to in the scenarios below must be created individually for each internal or external system you want to grant access to. Upon app creation, you receive the Client Id and Client Secret.</p>\n</blockquote>\n<p><strong><a href=\"#implement-m2m-authorization-with-loginradius-apis\">Scenario 1</a>:</strong> To grant desired access to your LoginRadius Management APIs.</p>\n<p>To start using the M2M Authorization for this scenario, you need to create an M2M App and define the desired scope of API(s), as <a href=\"https://www.loginradius.com/docs/api/v2/single-sign-on/Machine-to-Machine/overview/#adminconsoleconfigurationformmauthentication3\">explained here</a>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 417px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 122.78177458033572%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAZCAIAAAC+dZmEAAAACXBIWXMAAAsTAAALEwEAmpwYAAACRUlEQVQ4y5VU/07bMBDOu+0B9kKMjTKVv6Zp0v7cJJgKLUhj06RpewUQbLRFY0C70rIONXHsJHbs2LHTnZNW9AfQ8unL6S72d2edT3Z8H7se8jyEEHZdN6JMa51a6HkqlRYEH3Y6hBDkAwhCPqQIgoBzHk9hFCqlhhNgMXcCgjHyCPYJJj7GcBAgxjZX4SPfuvBRSufETPghw5QrbYbDrFjIctgwGwXjlWmxx7XLlBunUs+tT6PIkGcbi2kUhEEQEgznV0oOl4YVYyZQxHGckFiGSRpJ/TCZ0t0g+YVEzLlDhPJYQkQaShMkGkhyax2RzhCLNErSM48f9JkV04jCDWbGGK2NTnNrHbjsLMsWHBsuMEkSuHY1AZnb+8RF5+D+HSkVVMomYPII5iyRakFlwYXK520Gxc8FYhhMEoRRRC3pLeGXXFxZcC6ENiZv2S2K+gvE0C1Q2wRC2BaPqZYRQ9OEgAwSYCawVGWTNxeCO4+d3YOROB8KMGb4SFjxSaN5eHR8dPwDnHrjtLD1RvNnvQF+QQhPIKw3683T3xeXZ+cX7c5VGFHn67fv1dpupVr7sGO5tV2rVPd2P+4X4Qy3tqublZ13m5W9/c8IY6f3b9DuD/70b3rXf4Hd3nWr3QFbhDPsXHUvW+3zi1an07WVS18On7w/ePr609paaaW08axUXl0vg72Tq6Xy8/WNlRcvX715C8+m0x943RvPpzFkYizOycbOPC3gMYNHkrIYxhPeECLTTKTZo7tdPHdmbjwfBmyGc/4H8GF9T4Y+jMEAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Manage Machine to Machine App\"\n        title=\"Manage Machine to Machine App\"\n        src=\"/static/1e60d54fd37696feeaa54f36f5eb455c/f27fb/manage-machine-to-machine-app.png\"\n        srcset=\"/static/1e60d54fd37696feeaa54f36f5eb455c/f27fb/manage-machine-to-machine-app.png 417w\"\n        sizes=\"(max-width: 417px) 100vw, 417px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><strong><a href=\"#implement-m2m-authorization-with-business-apis\">Scenario 2</a>:</strong> To grant desired access to your Business APIs.</p>\n<p>To start using the M2M Authorization for this scenario, you need to define your API in LoginRadius with name, identifier, and scope details and then create an M2M App with the desired scope of API(s), as <a href=\"https://www.loginradius.com/docs/api/v2/single-sign-on/Machine-to-Machine/overview/#adminconsoleconfigurationformmauthentication3\">explained here</a>. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 477px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 107.33752620545074%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAIAAADJt1n/AAAACXBIWXMAAAsTAAALEwEAmpwYAAACCUlEQVQ4y5VUbW/TMBD2f+Wn7A9MQtApVaYh8al76dvYhka3tmnaDBgwPvEiWki3NQltlxc7PjtpyiV0CKiydU8en3w5n32584VMJlPLsm3HGVmOZaO0f47Hnuf5OFx8PN8PvFsIIea3SJKEoA7AJUoRcxEDpGqYgbFUcs4ZguII4zj+xzkAeR1IK5DjMJol89WROoMQPuMB4z4LpZTJaphnkmBYruumH3jjYpDZlisyIRTEpRteTqlFpcMii4q7aTNh+nDybRKEQAIuzBs2dMMrH5DXgVjmb9NigQ+mx59/dAZTTjiAH9AQIJ7NcphgIv8jjxJMLwEASinWA6u1AJYrQ/YGoijKzzaemVVvOaUxnptfvYUz7h8vAf3QEEXxPc6IWQ7Skt7hjBcDv0rmAE1/h4PaH2Jw6cl5KbkXxBwOt8vVUrlW2qtu71V3yigrlfp+pf6itFvBecYqztFUqR8g6wdHO+Xapy9fiW3bZ139ja4ZvV6nd6YbRlPTdeP12/P3qbqggewgu0ZL00+a7aPjRn/wg1w549rF4Nm5ud99p7W1VqfbaLaPT1tNrYPrlomejdP24ctX/f538tkcrR1+eLR7sbZVLirKE0UtFNWN4mZB2XyqqMssKKqibq0/LmBoBNt8ao8k9WR27x7YzwBuwChIEc2i7G6siKwlGcPewK7Gf87DyMJfHQWQQ8vRf6cAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Manage Authorization Server APIs\"\n        title=\"Manage Authorization Server APIs\"\n        src=\"/static/700d967b2519585e4f83f0f9bd9e65cc/d743b/manage-authorization-server-apis.png\"\n        srcset=\"/static/700d967b2519585e4f83f0f9bd9e65cc/d743b/manage-authorization-server-apis.png 477w\"\n        sizes=\"(max-width: 477px) 100vw, 477px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>In both scenarios, you get the Client Id and Client Secret for the created app, which you need to share with the partner or service who wants to access your APIs.</p>\n<h3 id=\"client-credentials-grant-flow\" style=\"position:relative;\"><a href=\"#client-credentials-grant-flow\" aria-label=\"client credentials grant flow permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Client Credentials Grant Flow</h3>\n<p>LoginRadius M2M Authorization uses client credentials grant flow from OAuth 2.0. In this flow, the client (depicted as Server 1 and Server 2 in the diagram below) holds Client ID and Client Secret and uses them to request an access token.</p>\n<p>This grant-type flow occurs strictly between a client app and the authorization server. The user does not participate in this grant-type flow.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 512px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 50.5859375%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsTAAALEwEAmpwYAAABlUlEQVQoz31Ra2/TMBTd//8f0I2tdGOTGOIDUmEdr2qThjb6JG1ix4887DhxnMRxuWlWCT7A0bV1fe1z7XN85Jyztq2aBpIdxAGmbjJdVtbu/o0jOBQmkgvFZd6X3L7FEvPxj9UyoLlSQso0FXmeF6W5f3hcrDe1bTuyruo0L63beYhQQjjnURQlcfTkofs1nm+xFCKFSFOlsl9b9Pbd+9fnbyZfpx0ZruGJ8HykTcUYQwgFQSDS5NHDw/HdbIMzKRnnlFKlVEijye2XFy+Ph+dXHRkGVAmlbg9rbdM0XbHQPiYGzKhrXZZFUbRtC+Sbyefh6OJsdNlrrnEsmcjDWBw0d/M6jKbL4KcXxBFnDIIlSext0cdPk8HJ6cXV9Z5c1bLoNG8whQeHYUgIYZQutniB+CogQog4jsEIlWUo5N+md4PjVyeno+dn8yRdeZ2BEuQxBhJ0nj9tyODDd/DclFrsobXuDRrf3M4W62eyMSU46Q6f3CfaGB/T5u9/hi2E0Ww+h0a92273X7g/AEuQ4Ps+uAj5bw2aLjgZQa9YAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Client Credentials Grant Flow\"\n        title=\"Client Credentials Grant Flow\"\n        src=\"/static/08e87f1c9f74444e14c724cbbcd0cb1c/01e7c/client-credentials-grant-flow.png\"\n        srcset=\"/static/08e87f1c9f74444e14c724cbbcd0cb1c/01e7c/client-credentials-grant-flow.png 512w\"\n        sizes=\"(max-width: 512px) 100vw, 512px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ul>\n<li>The client (server) requests with the Client ID, Client Secret, Audience, and Claims to the authorization server.</li>\n<li>If the request is valid, the authorization server sends a JWT access token to the client (server). </li>\n<li>The client (server) uses the JWT access token to call LoginRadius Management or your APIs. APIs share data according to permissions given against the M2M app without using client Secret in this step.</li>\n</ul>\n<h2 id=\"implement-m2m-authorization-with-loginradius-apis\" style=\"position:relative;\"><a href=\"#implement-m2m-authorization-with-loginradius-apis\" aria-label=\"implement m2m authorization with loginradius apis permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implement M2M Authorization with LoginRadius APIs</h2>\n<ol>\n<li>\n<p>The client (partner, API, service, etc.) requests the access token using the following API:</p>\n<p>API endpoint: <code>https://api.loginradius.com/services/oauth/token</code></p>\n<p>The following is an example request:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">POST https://&lt;LoginRadiusAppName&gt;.hub.loginradius.com/service/oauth/token</span>\n<span class=\"grvsc-line\">Content-Type: application/json</span>\n<span class=\"grvsc-line\">{</span>\n<span class=\"grvsc-line\">  &quot;audience&quot;: &quot;`https://api.loginradius.com/identity/v2/manage&quot;,`</span>\n<span class=\"grvsc-line\">  &quot;grant_type&quot;: &quot;client_credentials&quot;,</span>\n<span class=\"grvsc-line\">  &quot;client_id&quot;: &quot;&lt;YOUR_CLIENT_ID&gt;&quot;,</span>\n<span class=\"grvsc-line\">  &quot;client_secret&quot;: &quot;&lt;YOUR_CLIENT_SECRET&gt;&quot;</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n</li>\n<li>\n<p>LoginRadius Authorization Server validates the request. Upon validation, it returns the JWT access token to the client.</p>\n<p>The following is an example response with an access token:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">{</span>\n<span class=\"grvsc-line\">  &quot;access_token&quot;: &quot;eyJz93a...k4laUWw&quot;,</span>\n<span class=\"grvsc-line\">  &quot;token_type&quot;: &quot;Bearer&quot;,</span>\n<span class=\"grvsc-line\">  &quot;expires_in&quot;: 86400,</span>\n<span class=\"grvsc-line\">}</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">JWT Token Details</span>\n<span class=\"grvsc-line\">{</span>\n<span class=\"grvsc-line\">  &quot;iss&quot;: &quot;https://&lt;LoginRadiusAppName&gt;.hub.loginradius.com/&quot;,</span>\n<span class=\"grvsc-line\">  &quot;sub&quot;: &quot;&lt;OAuth APPs APIKey&gt;@client&quot;,</span>\n<span class=\"grvsc-line\">  &quot;jti&quot;: &quot;&lt;unique Identifier&gt;&quot;</span>\n<span class=\"grvsc-line\">  &quot;aud&quot;:&quot;`https://api.loginradius.com/identity/v2/manage&quot;,  //or https://service.example.com/api/v2`</span>\n<span class=\"grvsc-line\">  &quot;cid&quot;: &quot;&lt;APPConfig APIKey&gt;&quot;,</span>\n<span class=\"grvsc-line\">  &quot;sid&quot;: &quot;&lt;LR access Token&gt;&quot;  </span>\n<span class=\"grvsc-line\">  &quot;exp&quot;: 1311281970,</span>\n<span class=\"grvsc-line\">  &quot;iat&quot;: 1311281670,</span>\n<span class=\"grvsc-line\">  &quot;scp&quot;: [</span>\n<span class=\"grvsc-line\">    &quot;profile:read&quot;,</span>\n<span class=\"grvsc-line\">    &quot;profile:create&quot;,</span>\n<span class=\"grvsc-line\">  ],</span>\n<span class=\"grvsc-line\">  &quot;gty&quot;:&quot;client_credentials&quot;</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n</li>\n<li>\n<p>The client can call APIs (as per the defined scope) using the JWT token. APIs will work based on permissions without the use of Client Secret.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">curl --request GET \\</span>\n<span class=\"grvsc-line\">  --url `https://api.loginradius.com/identity/v2/manage/account/{uid} \\`</span>\n<span class=\"grvsc-line\">  --header &#39;authorization: Bearer eyJhb……….jVZ2w&#39;</span>\n<span class=\"grvsc-line\">  --header &#39;X-LoginRadius-ApiKey: {apiKey}</span></code></pre>\n</li>\n<li>The respective API(s) will work according to the scope or permission.</li>\n</ol>\n<h2 id=\"implement-m2m-authorization-with-business-apis\" style=\"position:relative;\"><a href=\"#implement-m2m-authorization-with-business-apis\" aria-label=\"implement m2m authorization with business apis permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implement M2M Authorization with Business APIs</h2>\n<ol>\n<li>\n<p>The client (partner, API, service, etc.) requests the access token using the following API:\nAPI endpoint: https://<LoginRadiusAppName>hub.loginradius.com/service/oauth/token</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">POST https://&lt;LoginRadiusAppName&gt;.hub.loginradius.com/service/oauth/token</span>\n<span class=\"grvsc-line\">Content-Type: application/json</span>\n<span class=\"grvsc-line\">{</span>\n<span class=\"grvsc-line\">&quot;audience&quot;: &quot;&lt;business API endpoint&gt;&quot;,</span>\n<span class=\"grvsc-line\">&quot;grant_type&quot;: &quot;client_credentials&quot;,</span>\n<span class=\"grvsc-line\">&quot;client_id&quot;: &quot;&lt;YOUR_CLIENT_ID&gt;&quot;,</span>\n<span class=\"grvsc-line\">&quot;client_secret&quot;: &quot;&lt;YOUR_CLIENT_SECRET&gt;&quot;</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n<blockquote>\n<p><strong>Note:</strong> Where <code>&#x3C;LoginRadiusAppName></code> is the name of your LoginRadius App.\nIn response, the client will get an access token. </p>\n</blockquote>\n</li>\n<li>\n<p>Use the generated JWT token in the authorization for APIs.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">curl --request GET \\</span>\n<span class=\"grvsc-line\">--url &lt; API URL &gt; \\</span>\n<span class=\"grvsc-line\">--header &#39;authorization: Bearer eyJh………VZ2w&#39;</span></code></pre>\n</li>\n<li>The client will get access to the information as per the defined scope.</li>\n</ol>\n<h2 id=\"loginradius-m2m-authorization--benefits\" style=\"position:relative;\"><a href=\"#loginradius-m2m-authorization--benefits\" aria-label=\"loginradius m2m authorization  benefits permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>LoginRadius M2M Authorization — Benefits</h2>\n<p>Overall, M2M Authorization offers secure access to improve business efficiency — and ultimately enhances user experience. In detail, the benefits include but are not limited to:</p>\n<ul>\n<li>Secure data access across internal and external business systems</li>\n<li>Granular data access with predefined scopes with minimal configuration</li>\n<li>Efficient authentication and data exchange </li>\n<li>Grant, limit, or block access permissions at any time</li>\n</ul>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>M2M Authorization is a secure and reliable method of autonomous interactions. It aids business systems in achieving greater efficiency and eliminates the need for human involvement. It also enables businesses to provide flexible machine-to-machine communication while enforcing granular access, authorization, and security requirements.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","headings":[{"value":"What is M2M Authorization?","depth":2},{"value":"How LoginRadius M2M Authorization Works","depth":2},{"value":"Client Credentials Grant Flow","depth":3},{"value":"Implement M2M Authorization with LoginRadius APIs","depth":2},{"value":"Implement M2M Authorization with Business APIs","depth":2},{"value":"LoginRadius M2M Authorization — Benefits","depth":2},{"value":"Conclusion","depth":2}],"fields":{"slug":"/engineering/using-m2m-authorization-for-apis-and-apps/"},"frontmatter":{"metatitle":null,"metadescription":null,"description":"How can you ensure APIs, web services, and business systems communicate and access the information securely without human intervention? The answer is machine-to-machine (M2M) authorization.","title":"M2M Authorization: Authenticate Apps, APIs, and Web Services","canonical":null,"date":"April 29, 2022","updated_date":null,"tags":["M2M","Authorization","Authentication"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/55b15bddf195e3eaa39cb0e655abac95/03979/m2m-authorization-for-apis-apps-and-web-services.png","srcSet":"/static/55b15bddf195e3eaa39cb0e655abac95/f5f11/m2m-authorization-for-apis-apps-and-web-services.png 200w,\n/static/55b15bddf195e3eaa39cb0e655abac95/6d133/m2m-authorization-for-apis-apps-and-web-services.png 400w,\n/static/55b15bddf195e3eaa39cb0e655abac95/03979/m2m-authorization-for-apis-apps-and-web-services.png 800w,\n/static/55b15bddf195e3eaa39cb0e655abac95/aca38/m2m-authorization-for-apis-apps-and-web-services.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Kundan Singh","github":null,"bio":"Director of Product Development @ LoginRadius.","avatar":null}}}},"pageContext":{"id":"c70129fd-4709-5c3c-8cef-506212098a48","fields__slug":"/engineering/using-m2m-authorization-for-apis-and-apps/","__params":{"fields__slug":"engineering"}}},"staticQueryHashes":["1171199041","1384082988","1711371485","1753898100","2100481360","229320306","23180105","528864852"]}