'React Native Application and ASP.NET 6 API Azure Registration - Invalid JWT Signature

I am creating an application using React-Native and an asp.net core 6 API. I have registered both applications on Azure. When making a request from my Client Application for an access token, the request succeeds with a valid JWT according too jwt.io. However, I am recieving an error from my API that the token's signature is invalid. FYI I am also using version 2 of the token endpoints and I am logging in through a emulate android device. Not sure where to go from here.

Error enter image description here

Client Code

  const retrieveWorkouts = (accessToken:string) => {
    fetch(`${API_URL}/api/workout`, 
    {
        method: 'GET',
        headers: {
            Authorization: `Bearer ${accessToken}`,
            "Content-Type": "application/json"
        }
    })
    .then(response => {
        console.log(response)
        if(response.ok) {
            return response.json()
        }
    })
    .then(data => { 
        setWorkouts([...data])})
    .catch(error => {
        console.log(error)
    });
  }


Solution 1:[1]

So after a lot of reading through the Microsoft documentation, I learned more about Active Directory. The issue was with the Tenant I was using. My API was using my schools directory and when I tried to access my API it couldn't because the login account I was using was not a tenant in my school's directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Devin