Problem with REST with Basic Auth


#1

HI,
When i had create my dataSource i indicated that is a REST with Basic Auth.After validate all steps of creating, i had a new page's named xx-rest-basic-auth-login on the pages menu. But this page is not valide ! What i make wrong ?
What it's the good way to create and exploit REST Api with a Basic Auth?

here the json code
{

      "access": "Everybody",
      "components": [
        {
          "allowRegister": false,
          "col": 12,
          "events": {
            "login": [
              {
                "code": "sessionStorage['KA_REST_BASIC_TOKEN'] = Buffer.from(event.username + ':' + event.password).toString('base64')",
                "type": "execute"
              },
              {
                "path": "/",
                "type": "navigate"
              }
            ],
            "register": []
          },
          "name": "login0",
          "row": 0,
          "type": "login"
        }
      ],
      "events": {
        "load": []
      },
      "name": "kaRest Basic Auth Login"
    } 

Thx
Eric


#2

Hi Eric,

I've noticed that you want to convert user/pwd to base64 string. This can be done using btoa function, there is no Buffer.from in the browser.

It is not clear also where you call your REST data source with the token.

Best Regards,
Vladimir


#3

Hi Eric,

I spoke to soon, sorry. This page is indeed generated by Radzen in case of basic authorization in order to provide login. Can you provide more info what is not working for you? Do you have any errors in the browser console?

Best Regards,
Vladimir


#4

the page generated seem not correct, 2 times the name et this error

Best regards
Eric


#5

Hi Eric,

We've found the problem and we will provide fix in the upcoming release!

Thanks for the report!

Best Regards,
Vladimir


#6

Hi Eric,

We've just released Radzen 2.9.0 and this exception should be fixed.

Best Regards,
Vladimir


#7

Hi Vladimir,

installed and tested it's good :wink:

Thx

Best Regards
Eric