none
unable to access cookies object in redirectaccess.aspx in Outlook 2013 RRS feed

  • Question

  • I am creating an Office Mail app that saves the selected email to SharePoint. Therefore I followed the instructions in http://msdn.microsoft.com/en-us/library/jj687470.aspx to get the access token. Since the SharePoint uri of the access token is variable based on the SharePoint site that the user chooses to save the email. I saves the SharePoint URL in the HttpCookie object, so I can get it in the RedirectAccess page. This technique worked in Office 365 Outlook, but it failed in Office Outlook 2013. When the browser is launched to ask user to trust the application and redirected to the RedirectAccess page, the HttpCookie is empty in the RedirectAccess page, therefore, I cannot get the access token because it doesn't have the SharePoint url. All of this is working in Office 365, but it doesn't work in Outlook 2013. Is the cookie the correct mechanism to use for this purpose?  Any work-arounds or other methods to be able to pass information to the RedirectAccess page?

     

     Repro Steps

    1) Follow the instructions in http://msdn.microsoft.com/en-us/library/jj687470.aspx get access tokens to access SharePoint for an Office Mail app.
    2) Set a Cookie in the page the calls the Response.Redirect(TokenHelper.GetAuthorizationUrl(sharePointSiteUrl.ToString(), "Web.Read List.Write", "https://contoso.com/RedirectAccept.aspx"));
    3) Tries to retrieve the cookie in RedirectAccept.aspx page
    This works when this launched in the office outlook 365 app, but it doesn't work in office outlook 2013.

     

    Tuesday, February 5, 2013 3:21 PM

Answers

All replies

  • A workaround is to pass the variable as url parameter. Why this would work in OWA but not in Outlook i cant really say...it might be becouse of domain change during redirect and cookie is not valid anymore.

    Anze Javornik

    Tuesday, February 5, 2013 5:27 PM
  • If I use url parameter, I would call this

    Response.Redirect(TokenHelper.GetAuthorizationUrl(sharePointSiteUrl.ToString(), "Web.Read List.Write", "https://contoso.com/RedirectAccept.aspx?urlparam=urlvalue"));

    Right now, I call this

    Response.Redirect(TokenHelper.GetAuthorizationUrl(sharePointSiteUrl.ToString(), "Web.Read List.Write", "https://contoso.com/RedirectAccept.aspx"));

    I cannot use the url parameter because the ACS expects a static redirecturl of https://contoso.com/RedirectAccept.aspx when I register the app in SharePoint.  If I appended parameters to the redirecturl, the authcode returned from ACS becomes null.  Is there any other ways to pass info to redirectaccept.aspx page?

    Tuesday, February 5, 2013 8:13 PM
  • What is the domain of your app? contoso.com?

    If so then it might be that Response.Redirect is not sending the Set-Cookie header. Look at this thread http://www.victorfeinman.com/2011/05/setting-cookies-on-the-same-response-as-a-redirect-in-c/ .

    If the starting domain is not contoso.com i dont think you can do that with cookies.... well you can if you change the arhitecture in such a way that you redirect back to your starting domain, read the cookie and redirect to to contoso.com with url params from cookie(s).


    Anze Javornik

    Tuesday, February 5, 2013 10:15 PM