Skip to main content

UriJsonSource.AuthenticationInfo Property

Specifies the Basic authentication parameters that the associated web service endpoint requests.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v24.2.dll

Declaration

[Browsable(false)]
public HttpBasicAuthenticationInfo AuthenticationInfo { get; }

Property Value

Type Description
HttpBasicAuthenticationInfo

An object that specifies the Username and Password parameters.

Remarks

Use this property to provide authentication credentials to a JSON web service endpoint. Set this property to a HttpBasicAuthenticationInfo object and specify this object’s Username and Password properties.

public static JsonDataSource CreateReportDataSourceWithAuthenticationInCode() {
// ...
    // Create a new UriJsonSource object and configure authentication data in it
    var jsonSource = new DevExpress.DataAccess.Json.UriJsonSource();
    jsonSource.Uri = new Uri(@"http://northwind.servicestack.net/customers.json");


    jsonSource.AuthenticationInfo.Username = "user";
    jsonSource.AuthenticationInfo.Password = "pwd";

    jsonSource.HeaderParameters.Add(new HeaderParameter("MyAuthHeader1", "secretToken1"));
    jsonSource.HeaderParameters.Add(new HeaderParameter("MyAuthHeader2", "secretToken2"));

    jsonSource.QueryParameters.Add(new QueryParameter("id", "123456"));
    jsonSource.QueryParameters.Add(new QueryParameter("name", "MyName"));
    // ...
    // Create a JsonDataSource object and assign the UriJsonSource object to it
    var jsonDataSource = new DevExpress.DataAccess.Json.JsonDataSource() {
        JsonSource = jsonSource
    };

    return jsonDataSource;

View Example: How to Provide Authentication to Access Json Data in Reports

You can also specify authentication parameters in the application’s connection string and assign the connection name to the JsonDataSource‘s ConnectionName property.

Refer to the Provide Authentication to Access JSON Data (Runtime Sample) topic for information on how to provide a report‘s JSON data source with authentication parameters at runtime.

See Also