I want to create a REST export of view that returns JSON list of all files uploaded by a particular user . I have tried to create it as shown in blow image:
RESTExport.jpg
Here as shown in image I have added contextual filter for uid with relation user who have uploaded it and also permission with user who can edit own content.

So problem here is this works fine with browser ( cookie based auth ) but when I use this end point with REST client it fails with 403 forbidden despite of supplying Authorization header with correct basic auth string . Consider following image:
Request Failed.jpsg

REST client works fine when Access permission is set to none.

Also somebody provide a guidance for properly achieving this setup as it is generally required for mobile application developers who want to use Drupal 8 as backend.
How to make REST export which validates user id passed in contextual filter and also verifies certain permission too and based on that it returns related information?
i.e currently if i specify above configuration then in browser with login of user id 2 it is also able to see files for uid 1 by hitting files/1 , what I want is Drupal should validate that current login is not for user 1 so it should give me 403 in that case but files/2 should work fine.

CommentFileSizeAuthor
Request Failed.jpg67.3 KBvivekvpandya
RESTExport.jpg190.19 KBvivekvpandya

Comments

vivekvpandya created an issue. See original summary.

vivekvpandya’s picture

Issue summary: View changes
dawehner’s picture

Status: Active » Closed (duplicate)

Basically a duplicate of #2228141: Add authentication support to REST views

It will be solved there