Current filter:
                                You should refresh the page.
                                  • Hi,

                                    I have a server-side OData API which uses OAuth2 BearerToken authentication (OIDC).
                                    Client-side I am using the MSAL-angular (https://www.npmjs.com/package/@azure/msal-angular) library to implement authentication. This library depends on HttpInterceptor (the standard angular way to include e.g. Bearer tokens).

                                    However, the DevExtreme ODataContext requires the implementation of an beforeSend method which is quite archaic... I mean the Bearer-Token is nothing static. In the OIDC world we have to perform silent login requests, access token renewals, and so on.

                                    Without MSAL I am quite lost - no way to implement all those things manually... But with MSAL I cannot use the DevExtreme OData store...

                                    So how I am supposed to solve this problem - use the DevExtreme OData store with HttpInterceptor?

                                    Regards

                                    Dirk

                                • Dirk Schiffner 09.10.2019

                                  As a workaround I was able to implement some of the MSAL HttpInterceptor into the beforeSend() method. However I am missing one incredible import thing: When the data grid is making a request (with Bearer-Token in Authorisation header) and receiving a 401 (because the bearer-token is not valid anymore) I need to renew the token silently and resend the same (!) request again.

                                  Where can I place the code for renewing the token a resending the same request and how to send the same request again within an OData store?

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Dirk,
                                 
                                DevExtreme DataLayer components are not based on HttpClient. That is why, you cannot use HttpInterceptor for this task. We are researching the capability of integrating HttpClient into DevExtreme for angular components. However, I cannot provide you with any promises or estimates here. Once we find an appropriate solution, we will add it to DevExtreme.
                                Should you have any other questions, feel free to ask. We are here to help.

                                Updated:

                                Thank you for the update. In this case, you can try handling onDataErrorOccurred and/or errorHandler. Then, in the event handler, check the error message and resend a request using the gridInstance.refresh() method. Then, according to the received error, you will be able to change your request parameters in the beforeSend callback.

                                • Dirk Schiffner 09.10.2019

                                  As a workaround I was able to implement some of the MSAL HttpInterceptor into the beforeSend() method. However I am missing one incredible import thing: When the data grid is making a request (with Bearer-Token in Authorisation header) and receiving a 401 (because the bearer-token is not valid anymore) I need to renew the token silently and resend the same (!) request again.
                                  Where can I place the code for renewing the token a resending the same request and how to send the same request again within an OData store?

                                • Lex (DevExpress Support) 09.11.2019

                                  Hi Dirk,
                                   
                                  Thank you for the update. In this case, you can try handling onDataErrorOccurred and/or errorHandler. Then, in the event handler, check the error message and resend a request using the gridInstance.refresh() method. Then, according to the received error, you will be able to change your request parameters in the beforeSend callback.
                                   
                                  Please try this approach and let me know your results.