Search code examples
admin-on-restreact-admin

admin-on-rest: How to pass custom parameters to authClient


In admin-on-rest framework, the default authClient doesn't seem to have the ability to accept custom parameters such as url. The following url explained how to use authClient, but the example shows the url has to be part of authClient.js.

https://marmelab.com/admin-on-rest/Authentication.html

when I try to specify a custom argument (url) in App.js,

const api = 'http://10.1.16.138:8343/rest/...', 

<Admin ... authClient={authClient(api)}>
    ...
</Admin>

and add this paratermer in authClient.js,

export default (url, type, params) => {

...
const request = new Request(url, {...});

The authClient no longer works.

Is there a way to allow custom parameter without building a custom login page? If custom page has to be done, any suggestion on how to tweak authClient.js?


Solution

  • In your auth client, try replacing

    export default (url, type, params) => {
    

    By

    export default url => (type, params) => {
    

    It's not admin-on-rest, it's just JS.