We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

OdataV4 connector and JWT bearer token ( simple example?)


Now I have made working Odata WebApi with asp net core 3.1
that seems to work with BlazorDatagrid wirh OdataV4 connector

What is the correct and simple way add JWT bearer token to OdataV4 connector as I
implement [Authorize]  to controllers on  API project?

So controller still can read/write data from API

Best regards,

3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team June 9, 2020 06:55 AM

Hi Jukka,  

Thanks for contacting Syncfusion support. 

We understood that you want to Authenticate your OData WebAPI using the DataManager. We suggest you to achieve your requirement by passing the Authentication token to OData WebAPI as a Header using Headers property in DataManager. Refer the below code example. 

<SfGrid TValue="Order" AllowFiltering="true" AllowSorting="true" AllowPaging="true" Toolbar="@new List<string> { "Search" })">  
   <SfDataManager Headers=@HeaderData Url="@OdataUrl" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager> 
    private IDictionary<stringstring> HeaderData = new Dictionary<stringstring>();  
    protected override void OnInitialized()  
    public class Order  

Refer our UG documentation for your reference  

Please get back to us if you have further queries  

Renjith Singh Rajendran 

Marked as answer

AS ashimaz June 11, 2020 03:43 PM

When using blazor 18.1.55 client side grid with Adaptors.UrlAdaptor on authorized web, please add header as follows.

HeaderData.Add("Authorization", "bearer " + "your_auth_token");

VN Vignesh Natarajan Syncfusion Team June 12, 2020 06:14 AM

Hi Ashimaz,  

Thanks for your suggestion.  

Kindly get back to us if you have any other queries.   

Vignesh Natarajan 

Live Chat Icon For mobile
Up arrow icon