I have a view listing some fields from a content type then i made it in a Json format using View DataSource module, all is ok with me tell now

i want to add authentication token in the header request to restrict any user to access this json view

any module or code help me, thanks


views_datasource uses the standard drupal session to authenticate.

First set the permissions on the view to what you want. And test this in the browser.

then you can go onto your user authentication. Im assuming that you're using ajax to call the view, in a headless mode ?

then you've got 2 options

1) Make the users log into the Drupal site somehow first - that will then give them a session , and when they call that ajax request, the session will be sent.

2) Authenticate the user from your code - you can do this with the services module. you can follow this post https://www.drupal.org/node/910598 for more information

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.