jeudi 29 décembre 2016

Pass user context id as header to rest API

I have 2 applications - a laravel rest API and angular front end which are on 2 different domains. It is a multi tenant app where users can belong to one or more organisations and can switch between orgs within the app. I am using session storage so the user can have 2 or more tabs open and be logged into different orgs at the same time. All the data belongs to an org via foreign keys etc. I need to pass the org_id with most requests and am considering doing this via a custom header e.g. X-org-id. This would work nicely with the angular http interceptors and with a laravel middleware class that can automatically scope any data reading to the org id and auto populate org if for any create/update calls.

Is there any issue with using a custom header in this way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire