Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Server failed to authe...
Finance forum
Unanswered

Server failed to authenticate request. Make sure value of Authorization header

Posted on by 5

//in d365fno

[Control("Button")]

class Download

{

public void clicked()

{

super();

new Browser().navigate(LoaneeDocumentsTable.PassportFileURL);

}

}

{

public void clicked()

{

FileUploadTemporaryStorageResult result = File::GetFileFromUser() as FileUploadTemporaryStorageResult;

if (result && result.getUploadStatus())

{

LoaneeDocumentsTable.PassportFileURL = result.getDownloadUrl();

//store url into table field

info( LoaneeDocumentsTable.PassportFileURL);

}

}

}

i am getting this error on web browser in local VM. I want to download the file in system.

 

  • Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    Server failed to authenticate request. Make sure value of Authorization header
    Do you mean that you want to get the file contents to store it in a persistent storage (e.g. as a record attachment)? If so, you can use File::UseFileFromURL(result.getDownloadUrl()) to get the file contents as a data stream.
  • AM-09080902-0 Profile Picture
    AM-09080902-0 5 on at
    Server failed to authenticate request. Make sure value of Authorization header
    thank you Martin for the answer. yes you are right. then how can i download the file from url. 
  • Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    Server failed to authenticate request. Make sure value of Authorization header
    It's a pity that you didn't tell us where your code is failing, but I'm guessing it's when calling navigate() in Download.clicked().
     
    To me, the whole idea of storing the temporary storage URL is wrong, because it's temporary. It expires after some time and can't be used anymore.
     
    (Moved from Dynamics AX forum.)

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans