jeudi 3 décembre 2015

Ember-simple-auth: How to add authorization header to browser-initiated requests

I'm using oAuth2.

The DataAdapterMixin automatically adds the Authorization header to all Ember Data requests. The session service authorize method can be used to add it to Ajax calls, but how can I ensure the header is added to GET requests made from the browser. I've tried creating a custom authorizer as explained in the docs, but the authorize method is not called.

The my application stores scans of invoices and statements (usually pdfs) which can only be seen by an authorized user. Based on the user's actions, I am changing the data attribute of an object tag.

This

<object data={{attachViewURL}} width="800px" height="1200px">

is rendered as something like this:

<object data="/scans/attachments/11"  width="800px" height="1200px">

This works fine except the authorization.

Any advice would be most appreciated. I'm new to Ember, so if I am going about this the wrong way, please let me know.




Aucun commentaire:

Enregistrer un commentaire