Hi All, my Project is developed in Asp.net (webform). By using OWIN i need to implement below 2 requirement
1. I want to integrate IDP (Azure AD) User Authentication on that project like when the user try to visit our website then first the user will be redirected to IDP login page (Azure AD). There the user will enter his credential and then after successful authentication the user will be redirected to our project home page.
2. Once the user redirected then in our code we should able to capture the access_token and that access_token we need to pass in the header while calling webservice for loading other functionalities.
For now I am able to achieve 1st requirement but facing issue in implementing 2nd requirement i.e capturing the Access_token on my project after successful authentication in IDP.
So can anybody please help me on this by providing a working example.
Tuhin PaulPosted May 30, 2024, 6:56 PM
There are several reasons why you might be getting a null access token and null properties in
context.ProtocolMessageeven after following the provided code. Check you've replaced "your-client-id" and "your-tenant-id" with the actual values from your Azure Active Directory (AAD) application registration.sunil mohantyPosted May 28, 2024, 2:56 PM
Hi Abhishek, Thank you for your response. I have used the below code provided by you but still I am getting accessToken as null. Infact all the properties coming under context.ProtocolMessage are null.
Abhishek ChadhaPosted May 28, 2024, 5:21 AM
Here's how you can capture the access token in your ASP.NET WebForms application:
2. Configure OWIN middleware in your
Startup.csfile:3. In your code-behind file or wherever you need to use the access token, you can retrieve it from the session or wherever you stored it: