none
Invalid Application Creation Token on CREATEAPPLICATION

    Question

  • I have a SODA application and I'm looking to redirect the user to create an application and authorizing it following the steps of http://msdn.microsoft.com/en-us/library/hh567903.aspx 

    I'm using the XML API. 

    Given the response of NewApplicationCreationInfo:

    <?xml version="1.0" encoding="UTF-8"?>
    <response>
       <status>
          <code>0</code>
       </status>
       <wc:info xmlns:wc="urn:com.microsoft.wc.methods.response.NewApplicationCreationInfo">
          <app-id>a4492dcb-b783-47b8-9794-b2fa05a45744</app-id>
          <shared-secret>1VtWq5STyfunpL3D1NsgcQlkobI/XSVVdGWkiyq1ygg=</shared-secret>
          <app-token>AiAAAMlfgj4qbYtMq3fK7dY/JYRpwIZrt8FgF6avI9bSirMus3Lt/BjqCU65dcsa/Tkke+AAAADmNcYtC7tUvwkgbaFg8XX/CYoVHRUszHXyvOq+RH/9UFe46IJiVZsyNQfqzOHO4KVMvaZVoLprgv2ktK3dnYOf+yxrReesp/krxyb8NHZQ0rXX/9YWtwTFheBYU1FcyjBBKnXWe9YVA5qGuS9ftIn9CFYbDreponqsktfBm9FVEat8AFnbNYx6R55n/wexBBWb6Dvh3+V/NkOAujt9oPyQHSx9q/5UNCSKq2Q8rn9I/TLJrGalXeW3EeUiOU81LoC///5M/8YESFq7ynaLrgrBhZgmskY7e3T8f+Mx31jDRyAAAABEPl3ovITTF7mMnEv5GmsJGaYCPCU+zRcdAPEVaol3niAAAABEPl3ovITTF7mMnEv5GmsJGaYCPCU+zRcdAPEVaol3ng==</app-token>
       </wc:info>
    </response>

    I've created the following url for redirection:

    https://account.healthvault-ppe.com//redirect.aspx?target=CREATEAPPLICATION&targetqs=%3Fappid%3D831f505f-9bd7-4d96-a123-2e4c4a1e70e3%26appCreationToken%3DAiAAAMlfgj4qbYtMq3fK7dY%2FJYRpwIZrt8FgF6avI9bSirMus3Lt%2FBjqCU65dcsa%2FTkke%2BAAAADmNcYtC7tUvwkgbaFg8XX%2FCYoVHRUszHXyvOq%2BRH%2F9UFe46IJiVZsyNQfqzOHO4KVMvaZVoLprgv2ktK3dnYOf%2ByxrReesp%2Fkrxyb8NHZQ0rXX%2F9YWtwTFheBYU1FcyjBBKnXWe9YVA5qGuS9ftIn9CFYbDreponqsktfBm9FVEat8AFnbNYx6R55n%2FwexBBWb6Dvh3%2BV%2FNkOAujt9oPyQHSx9q%2F5UNCSKq2Q8rn9I%2FTLJrGalXeW3EeUiOU81LoC%2F%2F%2F5M%2F8YESFq7ynaLrgrBhZgmskY7e3T8f%2BMx31jDRyAAAABEPl3ovITTF7mMnEv5GmsJGaYCPCU%2BzRcdAPEVaol3niAAAABEPl3ovITTF7mMnEv5GmsJGaYCPCU%2BzRcdAPEVaol3ng%3D%3D%26instanceName%3DSFDC

    When I paste this URL in the browser I'm redirected to the login page to authorize the application but after logging in I receive an "Invalid Application Creation Token" error. 

    I've tried to build the url by encoding it differently but no results. Is it possible I've missed some previous step? 

    Thanks




    • Edited by Fernando Rod Saturday, December 14, 2013 5:26 PM
    Saturday, December 14, 2013 5:26 PM

Answers

  • Hi,

    It looks to me like the query parameters need to be formatted a little differently. 

    When redirecting to Shell, each query parameter in the targetqs string needs to be url encoded.  Then, the entire targetqs string itself needs to be url encoded.

    Something like:

    String targetqs=String.format(
        "?appid=%s&appCreationToken=%s&instanceName=%s",
        UrlEncode("11111111-1111-1111-111111111111"),
        UrlEncode""AiAAAMlfgj4qbYtMq3f...");
        UrlEncode("my-instance-name"));
    
    String queryString =
        "https://account.healthvault-ppe.com/redirect.aspx?target=CREATEAPPLICATION&targetqs="
        + UrlEncode(targetqs);
    

    Hope this helps!

    • Marked as answer by Fernando Rod Tuesday, December 17, 2013 1:44 PM
    Monday, December 16, 2013 9:45 PM

All replies

  • Hi,

    It looks to me like the query parameters need to be formatted a little differently. 

    When redirecting to Shell, each query parameter in the targetqs string needs to be url encoded.  Then, the entire targetqs string itself needs to be url encoded.

    Something like:

    String targetqs=String.format(
        "?appid=%s&appCreationToken=%s&instanceName=%s",
        UrlEncode("11111111-1111-1111-111111111111"),
        UrlEncode""AiAAAMlfgj4qbYtMq3f...");
        UrlEncode("my-instance-name"));
    
    String queryString =
        "https://account.healthvault-ppe.com/redirect.aspx?target=CREATEAPPLICATION&targetqs="
        + UrlEncode(targetqs);
    

    Hope this helps!

    • Marked as answer by Fernando Rod Tuesday, December 17, 2013 1:44 PM
    Monday, December 16, 2013 9:45 PM
  • Excellent!

    That was the issue. 

    Values need to be encoded and then the whole targetqs needs to be encoded again.

    Thanks a lot!


    Tuesday, December 17, 2013 1:45 PM