Authorization Mixin

The AuthorizationMixin provides configuration for HTTP Authorization. It is a mixin class for storage of a token value for use with an HTTP Authorization request-header.

The default solution uses localStorage['AuthorizationHeader'] to keep the token value.

The stored token value is set on the HTTP 'Authorization' request-header when making a request for data from the server.

The adapter defines a fetchAuthorizationHeader method which sets the Authorization header. The mixin provices the header value in a authorizationCredential property. Use this property to store authentication credentials/token used with HTTP authentication.

Set the authorizationHeaderField to the key of the request-header you server expects. The default value is 'Authorization'.

Set the authorizationHeaderField property as the key to store the header name; the default value is 'AuthorizationHeader'.

The default behavior of the authorizationCredential computed property is to get and set the token value using localStorage['AuthorizationHeader'].

Include the mixin in an adapter to use an "Authorization" header with HTTP requests. Fetch (or XHR) requests may use the credential/token value as needed for authorization.

results matching ""

    No results matching ""