{"id":3201,"date":"2025-12-10T14:44:45","date_gmt":"2025-12-10T13:44:45","guid":{"rendered":"https:\/\/france.magicsoftware.com\/blog\/?p=3201"},"modified":"2025-12-11T14:48:48","modified_gmt":"2025-12-11T13:48:48","slug":"oauth2-microsoft-identity-platform-magic-xpi","status":"publish","type":"post","link":"https:\/\/france.magicsoftware.com\/blog\/magic-xpi\/oauth2-microsoft-identity-platform-magic-xpi\/","title":{"rendered":"Microsoft Identity Platform &#8211; Magic xpi"},"content":{"rendered":"\n<p><strong>Goal : Configure OAuth2 Authentication for Magic xpi RESTful API Service using Microsoft identity platform Application2Application<\/strong><\/p>\n\n\n\n<p>1\/ Sign on your azure portal and register an application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"510\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG1-1024x510.png\" alt=\"\" class=\"wp-image-3204\" style=\"aspect-ratio:2.0079355352656414;width:649px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG1-1024x510.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG1-300x150.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG1-768x383.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG1.png 1507w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Register a New app with these information for example \u00ab\u00a0MyOauth2App2App\u00a0\u00bb (no need to define a Redirect URIs)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"947\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG5.png\" alt=\"\" class=\"wp-image-3210\" style=\"aspect-ratio:0.9609451053508671;width:358px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG5.png 910w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG5-288x300.png 288w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG5-768x799.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/figure>\n\n\n\n<p>Click on App roles and create an app role<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"548\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6-1024x548.png\" alt=\"\" class=\"wp-image-3212\" style=\"aspect-ratio:1.868637905962191;width:648px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6-1024x548.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6-300x160.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6-768x411.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6-1536x821.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG6.png 1741w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on API Permissions and remove Microsoft Graph (User.Read)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"436\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7-1024x436.png\" alt=\"\" class=\"wp-image-3214\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7-1024x436.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7-300x128.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7-768x327.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7-1536x653.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG7.png 1540w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on Add a permission and choose your API and app role<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"395\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8-1024x395.png\" alt=\"\" class=\"wp-image-3216\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8-1024x395.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8-300x116.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8-768x296.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8-1536x592.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG8.png 1836w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"554\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9-1024x554.png\" alt=\"\" class=\"wp-image-3217\" style=\"aspect-ratio:1.8483993794951348;width:806px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9-1024x554.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9-300x162.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9-768x416.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9-1536x831.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG9.png 1728w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Grant admin consent<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG10-1024x545.png\" alt=\"\" class=\"wp-image-3219\" style=\"aspect-ratio:1.8789781524169964;width:750px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG10-1024x545.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG10-300x160.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG10-768x408.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG10.png 1397w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on Expose an API and add a scope, keep the value and Click Save and continue<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"559\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13-1024x559.png\" alt=\"\" class=\"wp-image-3221\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13-1024x559.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13-300x164.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13-768x419.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13-1536x838.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG13.png 1725w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Set the scope name, admin consent display name and description then click Add scope<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"559\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14-1024x559.png\" alt=\"\" class=\"wp-image-3223\" style=\"aspect-ratio:1.831865828092243;width:691px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14-1024x559.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14-300x164.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14-768x419.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14-1536x838.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG14.png 1717w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on certificates and secrets and create a new secret and keep your secret in a safe place.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"676\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG11-1024x676.png\" alt=\"\" class=\"wp-image-3225\" style=\"aspect-ratio:1.514804798557659;width:693px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG11-1024x676.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG11-300x198.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG11-768x507.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG11.png 1030w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on Overview =&gt;Endpoints and copy the token v2 URL, your client id and tenant id<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"377\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1-1024x377.png\" alt=\"\" class=\"wp-image-3230\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1-1024x377.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1-300x110.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1-768x283.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1-1536x565.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG12-1.png 1886w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>2\/ Check with Postman that you can get an access token like below<\/p>\n\n\n\n<p>make a POST on your token URL and pass in the body (clientid, client secret, grant type and scope) in urlencoded format<\/p>\n\n\n\n<p>Set the scope with :  api\/\/&lt;yourclientid&gt;\/.default<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"456\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG15-1024x456.png\" alt=\"\" class=\"wp-image-3231\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG15-1024x456.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG15-300x134.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG15-768x342.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG15.png 1463w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3\/ Check in the token that you get \u00ab\u00a0RoleREST\u00a0\u00bb (roles) and the issuer (iss)<\/p>\n\n\n\n<p>Use : https:\/\/www.jwt.io<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"641\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG16-1024x641.png\" alt=\"\" class=\"wp-image-3234\" style=\"aspect-ratio:1.5975184652512004;width:752px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG16-1024x641.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG16-300x188.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG16-768x480.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG16.png 1266w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4\/ Create an xpi project and create a RESTFul API service like below<\/p>\n\n\n\n<p>(*) In my example, i use 6443 for the apache\/tomcat port (can be change in the server.xml file in the apache conf directory)<\/p>\n\n\n\n<p>Create GetTime path<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"700\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG17.png\" alt=\"\" class=\"wp-image-3235\" style=\"width:564px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG17.png 1020w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG17-300x206.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG17-768x527.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<p>5\/ Create a new flow and use a RESTFul API connector  in the trigger area<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"763\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG18-1024x763.png\" alt=\"\" class=\"wp-image-3236\" style=\"aspect-ratio:1.3420777784604043;width:530px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG18-1024x763.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG18-300x224.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG18-768x572.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG18.png 1051w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the last step use a Flow Data to, update C.userblob variable with a simple json containing the time (&lsquo;{\u00ab\u00a0time\u00a0\u00bb:\u00a0\u00bb&lsquo;&amp;TStr (Time (),&rsquo;HH:MM:SS&rsquo;)&amp;'\u00a0\u00bb}&rsquo;) and C.usercode with 201.<\/p>\n\n\n\n<p>6\/ Open the XML service definition file of your RESTFul service  under your project directory<\/p>\n\n\n\n<p>(ex : &lt;Magicxpi installation directory&gt;Runtime\\projects\\OAuth2_Keycloak\\OAuth2_Keycloak\\RESTful API\\MyRESTfulAPI)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"203\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG19.png\" alt=\"\" class=\"wp-image-3238\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG19.png 673w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG19-300x90.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/figure>\n\n\n\n<p><strong>Add the oauth2 resource server in the securityDefinitions<\/strong><\/p>\n\n\n\n<p>Use the iss value from the token (step 3) for the issuerUri for the tag &lt;resourceServer><\/p>\n\n\n\n<p>Add a security role (\u00ab\u00a0RoleREST\u00a0\u00bb) (step 3) for the endpoint you want to protect for the tag &lt;security><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"333\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20-1024x333.png\" alt=\"\" class=\"wp-image-3240\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20-1024x333.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20-300x98.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20-768x250.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20-1536x500.png 1536w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG20.png 1589w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>7\/ Copy the war file (<strong>xpiREST.war<\/strong>) from your installation directory (ex: <strong>&lt;Magicxpi installation directory>\\Runtime\\addon_connectors\\RESTfulAPI\\servicefiles<\/strong> to your webapps apache directory (ex: <strong>&lt;Magicxpi installation directory>\\Runtime\\apache-tomcat\\webapps<\/strong>)<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>!! Use the last version of the war file<\/strong><\/p>\n\n\n\n<p>8\/ Start your apache server (startup.bat) from your apache directory (ex : &lt;Magicxpi installation directory&gt;\\Runtime\\apache-tomcat\\bin) using command line (Admin mode)<\/p>\n\n\n\n<p>9\/ Copy the service definition file from step6 to directory \u00ab\u00a0rest-services\u00a0\u00bb  of your apache\/tomcat <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"156\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG21.png\" alt=\"\" class=\"wp-image-3242\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG21.png 683w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG21-300x69.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p>10\/ Start your magic xpi project<\/p>\n\n\n\n<p>11\/ Use Postman to call Magic xpi service and use the bearer token you got from step 2\/ <\/p>\n\n\n\n<p>Set the Authorization header with the Bearer token<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"430\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG22-1024x430.png\" alt=\"\" class=\"wp-image-3244\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG22-1024x430.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG22-300x126.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG22-768x322.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG22.png 1289w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You should receive status 201 with the time value<\/p>\n\n\n\n<p>12\/ Set a wrong role in the service definition file in your apache directory<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"963\" height=\"575\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG23.png\" alt=\"\" class=\"wp-image-3245\" style=\"aspect-ratio:1.6748464590466874;width:590px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG23.png 963w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG23-300x179.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG23-768x459.png 768w\" sizes=\"auto, (max-width: 963px) 100vw, 963px\" \/><\/figure>\n\n\n\n<p>If you call again the service, you should get error status 403 Forbidden<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"435\" src=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG24-1024x435.png\" alt=\"\" class=\"wp-image-3246\" style=\"aspect-ratio:2.354156189381421;width:782px;height:auto\" srcset=\"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG24-1024x435.png 1024w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG24-300x128.png 300w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG24-768x326.png 768w, https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG24.png 1275w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goal : Configure OAuth2 Authentication for Magic xpi RESTful API Service using Microsoft identity platform Application2Application 1\/ Sign on your azure portal and register an application. Register a New app with these information for example \u00ab\u00a0MyOauth2App2App\u00a0\u00bb (no need to define a Redirect URIs) Click on App roles and create an app role Click on API [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3250,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[31,4,28,88,27],"tags":[11,14],"class_list":["post-3201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-magic-xpi","category-microsoft","category-microsoft-identity-platform","category-oauth2","tag-azure","tag-magic-xpi"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/france.magicsoftware.com\/blog\/wp-content\/uploads\/2025\/12\/AZ_OAUTH2_MG25.png","_links":{"self":[{"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/3201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/comments?post=3201"}],"version-history":[{"count":33,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/3201\/revisions"}],"predecessor-version":[{"id":3284,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/3201\/revisions\/3284"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/media\/3250"}],"wp:attachment":[{"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/media?parent=3201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/categories?post=3201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/france.magicsoftware.com\/blog\/wp-json\/wp\/v2\/tags?post=3201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}