Authorize multiple resources while working with OAuth2 request


Recently, I had a requirement where I had to grant access to a user to use SharePoint as well as CRM using Azure App. While working on this, I came across an OAuth2 request that would allow us to get access tokens & refresh tokens using the scope of required resources (here, CRM & SharePoint).

Since multiple scopes were being accepted, I went ahead and passed scopes of CRM SharePoint in the same request. The request was similar to the below –

var b2cAuthUri = "https://login.microsoftonline.com/" + tenantId + "/oauth2/v2.0/authorize?"+

"client_id=" + clientId +

"&response_type=code" +

"&redirect_uri=" + redirectUrl +

"&scope=offline_access"+" "+crmURL + "/user_impersonation" +" "+ sharepointSite +

"/User.read.all Sites.FullControl.All " + "";

After the above request, I continued to perform operations according to the requirement. When I used the generated access token to perform CRM-related functionality it worked as expected. However, when I used the same access…


Source link

More About This Author

Inogic
Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.
 
Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Author: Inogic

Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.   Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Share This Post On
Share via
Copy link
Powered by Social Snap