Microsoft Developer Network > Forums Home > Windows Live Developer Forums Forums > Windows Live ID: Development > insecure request with the new Delegated Authentication
Ask a questionAsk a question
 

Answerinsecure request with the new Delegated Authentication

Answers

  • Wednesday, March 12, 2008 5:46 PMJorgen Thelin - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    There are two reasons why you might get this “insecure request” message from the consent server:

    1.       You passed a bad app verifier

    2.       You passed a good app verifier, but the return URL you passed is either invalid or doesn’t map to that app verifier

     

    The app= parameter is the app verifier, which explains why removing that parameter sort-of removed the "insecure request" error.

     

    What's probably happening under the covers with your second problem is that the consent server is using the appid secret key you or someone else has previously registered for www.contoso.com to encrypt the token sent back, but your handler can't decode it if it doesn't have the key.

     

    If the consent token starts with delt then it's unencrypted, whereas if it starts with eact then it's encrypted.

     

    When you have registered an appid for delegated auth, you should include the appid and secret key in the app config file and the library code will then use that to generate the correct app verifier for you.

     

  • Thursday, March 13, 2008 9:09 PMChrisW_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    In the URL you posted above, the values of the ru, pl and app parameters of the request aren't URL encoded (the sig parameter of the application verifier is already URL encoded, but this is not enough):

    https://consent.live.com/Delegation.aspx?ps=SpacesPhotos.ReadWrite&ru=http://www.contoso.com/DelAuth/Sample1/delauth-handler.aspx&pl=http://www.contoso.com/DelAuth/Sample1/policy.html&app=appid=0016BFFD8000AE28&ts=1205339594&sig=b39H5m66Q0IqLzAgq84dmFe2Ta9ziHs591t6qFeL2wg%3d

     

    As a consequence, the server receives an incorrect application verifier as the non URL encoded value of the app parameter contains an & (instead of & ). To overcome this problem you have to manually encode the ps, appctx, ru, mkt, pl and app parameters.

     

    If you are using the WindowsLiveLogin class in your application, be sure not to put the return value of the GetConsentUrl function in a Uri class, as it seems to remove the URL encoding from the parameters.

All Replies

  • Wednesday, March 12, 2008 5:46 PMJorgen Thelin - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    There are two reasons why you might get this “insecure request” message from the consent server:

    1.       You passed a bad app verifier

    2.       You passed a good app verifier, but the return URL you passed is either invalid or doesn’t map to that app verifier

     

    The app= parameter is the app verifier, which explains why removing that parameter sort-of removed the "insecure request" error.

     

    What's probably happening under the covers with your second problem is that the consent server is using the appid secret key you or someone else has previously registered for www.contoso.com to encrypt the token sent back, but your handler can't decode it if it doesn't have the key.

     

    If the consent token starts with delt then it's unencrypted, whereas if it starts with eact then it's encrypted.

     

    When you have registered an appid for delegated auth, you should include the appid and secret key in the app config file and the library code will then use that to generate the correct app verifier for you.

     

  • Thursday, March 13, 2008 10:06 AMcakewho Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Both by Appid and Secret is provided in the app settings. The only way i can get it to work now is by setting the "Application verifed required:" to 0 (in the app center) and manually removing everything after "app=appid=" in the query string. I havn't really tried out the cookie returned yet but it passes the ValidateToken function so i guess its alright.

     

    /Thanks for the fast reply

  • Thursday, March 13, 2008 9:09 PMChrisW_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    In the URL you posted above, the values of the ru, pl and app parameters of the request aren't URL encoded (the sig parameter of the application verifier is already URL encoded, but this is not enough):

    https://consent.live.com/Delegation.aspx?ps=SpacesPhotos.ReadWrite&ru=http://www.contoso.com/DelAuth/Sample1/delauth-handler.aspx&pl=http://www.contoso.com/DelAuth/Sample1/policy.html&app=appid=0016BFFD8000AE28&ts=1205339594&sig=b39H5m66Q0IqLzAgq84dmFe2Ta9ziHs591t6qFeL2wg%3d

     

    As a consequence, the server receives an incorrect application verifier as the non URL encoded value of the app parameter contains an & (instead of & ). To overcome this problem you have to manually encode the ps, appctx, ru, mkt, pl and app parameters.

     

    If you are using the WindowsLiveLogin class in your application, be sure not to put the return value of the GetConsentUrl function in a Uri class, as it seems to remove the URL encoding from the parameters.

  • Sunday, March 16, 2008 5:09 PMMarkWHaroldson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am trying to integrate WLID into a Silverlight application and I have no choice but to use the UrI class. Is there a way to override this behavior?