B
bestrachit
Guest
I am trying to authenticate user for Azure SQL db access using windows authentication with token generation. I have followed the approach specified in blogs. Below is the code snippet.
var conn = (SqlConnection)this.Database.GetDbConnection();
conn.AccessToken = (new AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result;
The problem I am facing is in the token generation. The token does get generated but authentication fails. When I tried to decode the token, it shows wrong user account. Instead of taking my corporate email, it was taking one of my personal email id. I looked everywhere but couldn't find a solution to pass username.
Continue reading...
var conn = (SqlConnection)this.Database.GetDbConnection();
conn.AccessToken = (new AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result;
The problem I am facing is in the token generation. The token does get generated but authentication fails. When I tried to decode the token, it shows wrong user account. Instead of taking my corporate email, it was taking one of my personal email id. I looked everywhere but couldn't find a solution to pass username.
Continue reading...