Forum Discussion

pritesho's avatar
pritesho
Helper I
10 years ago
Solved

Single Signon from company website

I am trying to implement single signon per website user for our front end app so users don't have to log in the website twice.   I tried to use below code from Prologika site, however it fails on w...
  • pritesho's avatar
    10 years ago

    Here is how I solved it:

    I got it working finally.  Below is code.
     
     
    Use below code to encrypt password:-
     
    var secureString = new System.Security.SecureString();
    var password = "pwd here";
    var charArray = password.ToCharArray();
    foreach (var chara in charArray)
    {
        secureString.AppendChar(chara);
    }
    string myPassword = Util.EncryptString(secureString);
    Use below code, modification in above code to point to Common login path instead of TenantId based path.
     
    // perform two-leg OAuth
     System.Net.WebRequest request = System.Net.WebRequest.Create("https://login.microsoftonline.com/common/oauth2/token"as System.Net.HttpWebRequest;