![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@http-ext/plugin-auth
Advanced tools
Readme
A auth plugin for HttpExt.
This plugin takes care of handling authorization by:
Authorization
header with the given token automatically for each request matching a custom condition,401 Unauthorized
http responses.This plugins helps avoiding all the http interceptor boilerplate required to add the authorization token and detect token expiration.
Using matchers like matchOrigin
, we'll ensure that the token is sent to the right API.
This also helps using different tokens for different APIs in the same app.
The plugin requires @http-ext/core
and @http-ext/angular
to be installed.
yarn add @http-ext/plugin-cache @http-ext/core
or
npm install @http-ext/plugin-cache @http-ext/core
import { HttpExtModule } from '@http-ext/angular';
import { createAuthPlugin } from '@http-ext/plugin-auth';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
HttpClientModule,
HttpExtModule.forRoot({
deps: [AuthService],
config: (authService: AuthService) =>
createAuthPlugin({
shouldHandleRequest: matchOrigin('https://secure-origin.com'),
token: authService.getToken(), // Returns an Observable<string>.
onUnauthorized: () => authService.markTokenExpired(),
}),
}),
],
bootstrap: [AppComponent],
})
export class AppModule {}
You can give a partial configuration object it will be merged with default values.
Property | Type | Required | Default value | Description |
---|---|---|---|---|
token | Observable<string> | Yes | undefined | The bearer token that will be added to every matching request in the Authorization header. |
onUnauthorized | OnUnauthorized | No | undefined | A function executed when an unauthorized response is thrown. |
shouldHandleRequest | RequestCondition | No | undefined | Predicate function to know which request the plugin should handle. |
To know more about the shouldHandleRequest
property check-out the conditional handling section.
FAQs
> A auth plugin for [HttpExt](https://github.com/jscutlery/http-ext).
The npm package @http-ext/plugin-auth receives a total of 0 weekly downloads. As such, @http-ext/plugin-auth popularity was classified as not popular.
We found that @http-ext/plugin-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.