Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Last active February 16, 2018 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjwaight/183a57ed2d071d134e9ce28d363aa24e to your computer and use it in GitHub Desktop.
Save sjwaight/183a57ed2d071d134e9ce28d363aa24e to your computer and use it in GitHub Desktop.
Simple C# code showing how you use Custom Attributes from B2C in a solution.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public void Demo(string userObjectId)
{
/* Lookup the specified user object using object ID
GraphClient can be found at https://github.com/AzureADQuickStarts/B2C-GraphAPI-DotNet */
var graphResponse = await GraphClient.GetUserByObjectId(userObjectId);
var userJson = JObject.Parse(graphResponse);
// this is where our b2c-extension-app App ID is used (minus the dashes)
var userTierRating = userJson.SelectToken("extension_bb10b272026746f08b6f4367e8b1b1e6_TierRating");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment