Search code examples
restuwpwindows-10-universalhololenswindows-mixed-reality

UWP Device Portal app deployment Forbidden: CSRF Token Invalid


I am trying to deploy an application to a hololens with the Windows device Portal Rest API.

For some reasons I don't want to use the Microsoft Device portal wrapper.

In C#, with RestSharp, I can get the list of installed packages but when I try to deploy a new app, I get the error Forbidden because of CSRF token invalid.

Then I tried to add cookies from the previous request but I still get this error.

I tried to do the same with Postman but I have a different error: 413 Payload too large. The msix file is 154 MB but I have no problem to deploy it with the web device portal.

Thank you for your help.

[EDIT] I tried a smaller app on Postman and I get 403 CSRF token invalid


Solution

  • After analyzing the web device portal with wireshark I found that it is using a parameter with the name "X-CSRF-Token" while adding a cookie add the parameter "CSRF-Token".

    Manually adding this parameter with the right value did the trick.