Forum Discussion
GarethParry
Sep 14, 2022Copper Contributor
How do i test an application which uses OWIN login
Hi,
I have built a web application that usesOWIN security to authenticate users againt Azure Active Directory. I have added the re-direct URL to Azure so that after successful authentication it goes to the live website.
This all works as expected.
If i want to add and test new features to the site i use Visual studio to add the code, but when i run from VS it performs the authentication and then re-directs to the live site, not running the additional code.
How do i set it up to re-direct back to the test version running in VS?
thanks
Gareth
- chilbertoIron ContributorHello Gareth,
You will need to specify the re-direct to your local endpoint. In case you are not aware, the redirect happens at the client (browser) so a local reference (for example, https://localhost:7071/mywebsite) is ok.
You will also need to add teh redirect url in your application registration in AAD.- GarethParryCopper ContributorHi,
if i add it against my application registration in AAD then it still goes to the first re-direct which is the live version.
i need to add something in my VB project?
thanks
Gareth- chilbertoIron ContributorYes, you do. The redirect information is in the URL that your application sends to AAD. In my words, your local application on your pc constructs a URL for AAD. That contains who the application is including what location (url) AAD should send the browser back to once AAD is done authenticating the user.
This means your application needs to add the redirect url in the message. Your VB is already doing this and most likely it is in a configuration file. Have a search for the url in your code base. You might get lucky, find the value and simply be able to replace it with your local. Just don't forget to reverse the change before submitting your changes 🙂