0

My Drupal site is generating JSON through Views. I am using Services for that.

It is something like this:-

http://www.asite.com/api/views/all-date.json

Now the problem is that I want to restrict anyone from writing that URL in the any browser and retrieving all data.

Do you think there is a way to authenticate it?

Probably, in my external app, when I am accessing the data, I can add parameters to it so that it can only send data when it has right authentication.

Something like this:-

http://www.asite.com/api/views/all-date.json/?username=me&password=mine

I'll be grateful if you could help.

1 Answer 1

0

There exit many ways of authentication through services module.

The easiest is to use session authentication by authenticating the user using his username & password, Then let the app send the cookie header in each request with the session id like COOKIE: SESS_ID:SESS_name.

Or use that module that seems matching your approach a lot services_basic_auth

Another way is to authenticate the app itself by letting the app get an access token using a secret app id and password created on the website. using oauth2

Examples for auth methods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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