Android Question SimpleMediaManager - how to authenticate url?

andyr00d

Member
Licensed User
Longtime User
I have a requirement to authenticate with M365, which I can successfully do with a token that was previously issued. A simple DownloadImage job like this works fine with the same url:

B4X:
Sub DownloadImage(Link As String, myButton As Button)
    Dim token As String = kvs.Get("Token")
    Dim job As HttpJob
    job.Initialize("", Me)
    job.GetRequest.SetHeader("Authorization", "Bearer " & token)
    job.Download(Link)
    Wait For JobDone(job As HttpJob)
    If job.Success Then
        myButton.SetBackgroundImage (job.GetBitmap)
    End If
    job.Release
End Sub

however, I want to use SimpleMediaManager to do the same thing, via the url parameter - but it seems there is no way to set the Auth Header?

B4X:
MediaManager.SetMedia(pnl.GetView(x).GetView(0), https://xxxxx-my.sharepoint.com/personal/xxxxx/Documents/Pictures/test.jpg)

which returns ResponseError. Reason: FORBIDDEN, Response: I'm guessing because I did not pass along a token with the request, how can this be done?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0
Top