B4J Question [BANano] [SOLVED] How does one use BANanoFetch with authentication?

I don't have a server to test it, but it should be done using the BANanoFetchOptions (see https://www.b4x.com/android/forum/threads/banano-the-fetch-api.106666/#content):

So something like this:
Code: Copy
    Dim response As BANanoFetchResponse
    Dim error As BANanoObject
    Dim data As BANanoJSONParser
   
    Dim UserName As String = "myUserName"
    Dim Password As String = "myPassword"
   
    Dim options As BANanoFetchOptions
    options.Initialize
    options.Method = "GET"
    options.Headers = CreateMap("Authorization": "Basic " & BANano.ToBase64(UserName & ":" & Password))
  
    Dim fetch As BANanoFetch
    fetch.Initialize("https://myserver.com/basic-auth", options)
    fetch.Then(response)
        fetch.Return(response.json        )
    fetch.Then(data)
        Log(data)
    fetch.Else(error)
        Log(error)   
    fetch.End

Alwaysbusy
 
Upvote 0
Thank you.

Im trying the MJML API out and its really getting to my nerves because it does not seem to give me any result. Perhaps there is something I'm missing.

 
Upvote 0
Back
Top