# @reyesoft/ngx-auth

> Front-end authentication library using OAuth.

Latest version **3.1.3** (published 2026-07-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @reyesoft/ngx-auth
pnpm add @reyesoft/ngx-auth
yarn add @reyesoft/ngx-auth
bun add @reyesoft/ngx-auth
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1.3 |
| Published | 2026-07-08 |
| First published | 2019-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 417.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pablorsk, ahumadamatias, nicogarcia98 |

## Links

- npm: https://www.npmjs.com/package/@reyesoft/ngx-auth
- Repository: https://github.com/reyesoft/frontend-libraries/tree/master/libs/ngx-auth
- npm.io page: https://npm.io/package/@reyesoft/ngx-auth

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.2.0
- [@simplewebauthn/browser](https://npm.io/package/@simplewebauthn/browser.md) 13.3.0

## Recent versions

- 3.1.3 (latest) — 2026-07-08
- 3.1.1 — 2026-06-25
- 3.1.0 — 2026-06-18
- 3.0.1 — 2026-03-26
- 2.0.6 — 2026-03-15
- 2.0.5 — 2026-03-11
- 2.0.4 — 2026-02-09
- 3.0.0 — 2026-02-09
- 2.0.3 — 2025-12-17
- 1.1.3 — 2025-12-15
- 1.1.2 — 2025-12-12
- 2.0.2 — 2025-12-05
- 1.1.1 — 2025-11-24
- 2.0.1 — 2025-11-07
- 1.1.0 — 2025-09-22
- … 46 more at https://npm.io/package/@reyesoft/ngx-auth/versions

## README

# NGX Auth - Reyesoft

Front-end authentication library using OAuth.

## Quick start

0- Before starting, note that this library requires the following packages to be correctly configured in order to work fine:

-   angular-oauth2-oidc
-   ngx-jsonapi
-   ngx-jsonapi-material

1- Add ngx-auth to your Angular project

-   Using npm:

`npm install ngx-auth --save`

-   Using yarn:

`yarn add ngx-auth`

2- Import AuthModule in your main module (AppModule) and pass configuration using `forRoot` method

```typescript
import { AuthModule, AuthConfig, AuthMethodsConfig } from '@reyesoft/ngx-auth';
...
AuthModule.forRoot({
    api: {
        login_url: { route: environment.AUTHURL + 'some_url' },
        forgot_password_url: { route: environment.APIURL + 'some_url' },
        authorization_url: { route: environment.APIURL + 'some_url' },
        auth_code_login: { route: environment.APIURL + 'some_url' },
        social_login_url: { route: environment.APIURL + 'some_url' },
        reset_password_url: { route: environment.APIURL + 'some_url' }
    },
    routes: {
        login: { route: 'some_route', query_params: { query: 'some_query_parameter' }},
        sign_up: { route: 'some_route', query_params: { query: 'some_query_parameter' }},
        forgot_password: { route: 'some_route', query_params: { query: 'some_query_parameter' }},
        forgot_password_redirection: { route: 'some_route', query_params: { query: 'some_query_parameter' }},
        reset_password: { route: 'some_route', query_params: { query: 'some_query_parameter' }}
    },
    main_image_url: 'site_logo.svg',
    need_conditions: false,
    social_buttons: [
        { key: 'facebook', color: 'blue', svgIcon: 'facebook', text: 'Iniciar con Facebook' }
    ]
}),
...
```

**IMPORTANT:** don't forget to register the custom svgIcon used for social button in the MatIconRegistry (https://material.angular.io/components/icon/api#MatIconRegistry)

3- Inject AuthMethodsConfig in the main module constructor (AppModule) and provide your custom methods to the library

```typescript
import { AuthModule, AuthConfig, AuthMethodsConfig } from '@reyesoft/ngx-auth';
...
export class AppModule {
    public constructor(
        private authMethodsConfig: AuthMethodsConfig
    ) {
        this.configNgxAuth();
    }

    private configNgxAuth() {
        this.authMethodsConfig.registerUser = your_custom_method_to_register_a_new_user;
        this.authMethodsConfig.afterOAuthLoginMethod = your_custom_method_to_login_after_fetching_token;
        this.authMethodsConfig.afterOAuthRefreshMethod = your_custom_method_to_run_after_refreshing_token;
    }
...
```

4- If you want to refresh the access_token automatically using the refresh_token, provide OAuthInterceptor

```typescript
import { AuthModule, AuthConfig, AuthMethodsConfig, OAuthInterceptor } from '@reyesoft/ngx-auth';
...
{
    provide: HTTP_INTERCEPTORS,
    useClass: OAuthInterceptor,
    multi: true
},
...
```

5- Use the library's authentication components in your Login, Sign-up and Password Reset views

```typescript
import { ForgotPasswordComponent, ResetPasswordComponent, GuestStartComponent } from '@reyesoft/ngx-auth';
...
const routes: Routes = [
    {
        path: 'login',
        component: GuestStartComponent
    },
    {
        path: 'resetpassword',
        component: ResetPasswordComponent
    },
    {
        path: 'forgotpassword',
        component: ForgotPasswordComponent
    }
...
```

## List of exported classes

### Components

-   GuestStartComponent (includes Login and Sign up tabs)
-   ResetPasswordComponent
-   ForgotPasswordComponent
-   AuthorizationComponent
-   SocialButtonsComponent (included in login, but is also exported to be used somewhere else)

### Services

-   GuestStartService
-   ForgotPasswordService
-   ResetPasswordService

### Interceptors

-   OAuthInterceptor

### Classes

-   AuthConfig

---
_Source: https://npm.io/package/@reyesoft/ngx-auth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
