Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Problem with Azure AD JWT - solved

Problem with Azure AD JWT - solved

Scheduled Pinned Locked Moved .NET (Core and Framework)
cloudcomhostingsecurityjson
1 Posts 1 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pkfoxP Offline
    pkfoxP Offline
    pkfox
    wrote on last edited by
    #1

    I have an API and a client registered for authorization on Azure AD. When making a call to an endpoint which has the Authorize attribute on, I'm getting a 401 unauthorized response. I think the problem is, I'm using the wrong clientid/ResourceId combination when acquiring the token ( I get a token but it's invalid ) - anyone know which clientid/ResourceId I should be using when requesting the token ? On the API registration in Azure the values are

    ClientId: "0efb6359-0d88-4196-9f53-054b042b2ae1"
    Instance: https://login.microsoftonline.com/",
    ResourceId: "api://0efb6359-0d88-4196-9f53-054b042b2ae1/.default", // this should be 41eeebbd-ea7f-4f49-a936-1624b6cb9c72
    TenantId: "90fff3ee-9a7c-4eb1-8259-4d8c6bf6ca90"

    and the client

    ClientId: "41eeebbd-ea7f-4f49-a936-1624b6cb9c72",
    Instance: "https://login.microsoftonline.com/",
    ResourceId: "api://0efb6359-0d88-4196-9f53-054b042b2ae1/.default" // this should be 41eeebbd-ea7f-4f49-a936-1624b6cb9c72
    TenantId: "90fff3ee-9a7c-4eb1-8259-4d8c6bf6ca90"

    I'm confused ;) I've tried swapping out the clientid/ResourceId but to no avail hope this makes sense Edit I figured it out you have to put the clientid of the Client in the resourceid of the API

    Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups