microsoft / 30daysof

30 Day of Learning Resources, Samples and Curricula
https://aka.ms/30DaysOf
MIT License
169 stars 56 forks source link

Error npx port auto(8080) different from redirect URI port. #157

Open NovoaDev opened 1 year ago

NovoaDev commented 1 year ago

Error npx port auto(8080) different from redirect URI port.

In case someone gets the same thing that happens to me 😊. In my case npx http-server assign a different port than 8080 sometimes 8081/8082 depending on the ports it has busy. This causes it to redirect to another service after getting the token and throwing an error.

Error scenario

Service up on 8081
DiferentPortNpx

Error when redirecting Error8080

My solution

Manually assign a port that is free.

  1. Modify package.json. PackageMod

  2. Modify redirection aad.portal.azure configuration. SpaaadappMod

  1. Modify redirectUri in archive auth.js. AuthjsMod

Raise the service again and it worked :P 200OK