update authentication token before read method

0 Answers 74 Views
Grid
hamed
Top achievements
Rank 1
hamed asked on 29 Mar 2023, 01:30 PM

hi,

i use refresh token and access token is updating every time

i need call function before call read method to get new token and set in read function

like grid  , dropdownlist , ... read functions.

i use 'beforeSend' but it get one time token and in other call method dont update token.

 

 

 dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "https://localhost:44337/api/GetUserInstance",
                        type: 'Get',
                        beforeSend: async function (req) {
                        
                            var token2 = await GetToken2();
  
                            req.setRequestHeader('Authorization', 'Bearer ' + token2.data);
                        }
                    }
                },
                change: function () {

                }
            });

No answers yet. Maybe you can help?

Tags
Grid
Asked by
hamed
Top achievements
Rank 1
Share this question
or