{"id":13481409,"url":"https://github.com/neroniaky/angular-token","last_synced_at":"2026-04-19T01:06:01.726Z","repository":{"id":32857532,"uuid":"65271879","full_name":"neroniaky/angular-token","owner":"neroniaky","description":":key: Token based authentication service for Angular with interceptor and multi-user support. Works best with devise token auth for Rails. Example:","archived":false,"fork":false,"pushed_at":"2024-01-22T14:49:04.000Z","size":3323,"stargazers_count":368,"open_issues_count":49,"forks_count":184,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-14T11:52:15.694Z","etag":null,"topics":["angular","auth","authentication","devise","devise-token-auth","interceptor","interceptors","oauth","rails","signin","token"],"latest_commit_sha":null,"homepage":"https://stackblitz.com/github/neroniaky/angular-token","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neroniaky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-08-09T07:10:20.000Z","updated_at":"2025-04-29T21:18:27.000Z","dependencies_parsed_at":"2024-02-03T11:48:02.863Z","dependency_job_id":null,"html_url":"https://github.com/neroniaky/angular-token","commit_stats":null,"previous_names":["neroniaky/angular2-token"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroniaky%2Fangular-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroniaky%2Fangular-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroniaky%2Fangular-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroniaky%2Fangular-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neroniaky","download_url":"https://codeload.github.com/neroniaky/angular-token/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464897,"owners_count":22075571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","auth","authentication","devise","devise-token-auth","interceptor","interceptors","oauth","rails","signin","token"],"created_at":"2024-07-31T17:00:51.564Z","updated_at":"2026-04-19T01:05:56.669Z","avatar_url":"https://github.com/neroniaky.png","language":"TypeScript","readme":"![Angular-Token](https://raw.githubusercontent.com/neroniaky/angular-token/master/docs/angular-token-logo.png)\n\n[![npm version](https://badge.fury.io/js/angular-token.svg)](https://badge.fury.io/js/angular-token)\n[![npm downloads](https://img.shields.io/npm/dt/angular-token.svg)](https://npmjs.org/angular-token)\n[![Build Status](https://travis-ci.org/neroniaky/angular-token.svg?branch=master)](https://travis-ci.org/neroniaky/angular-token)\n[![Angular Style Guide](https://mgechev.github.io/angular2-style-guide/images/badge.svg)](https://angular.io/styleguide)\n\n🔑 Token based authentication service for Angular with interceptor and multi-user support. Works best with the [devise token auth](https://github.com/lynndylanhurley/devise_token_auth) gem for Rails.\n\n👋 This library has been renamed to **Angular-Token**! Please follow the [migration guide](https://angular-token.gitbook.io/docs/migrate-to-7).\n\n---\n\n### Quick Links\n\n- 🚀 View to demo on [Stackblitz](https://stackblitz.com/github/neroniaky/angular-token)\n- ✨ Learn about it on the [docs site](https://angular-token.gitbook.io/docs)\n- 🔧 Support us by [contributing](https://angular-token.gitbook.io/docs/contribute)\n\n---\n\n## Install\n0. Set up a Rails with [Devise Token Auth](https://github.com/lynndylanhurley/devise_token_auth)\n\n1. Install Angular-Token via NPM with\n    ```bash\n    npm install angular-token\n    ```\n\n2. Import and add `AngularTokenModule` to your main module and call the 'forRoot' function with the config. Make sure you have `HttpClientModule` imported too.\n    ```javascript\n    import { AngularTokenModule } from 'angular-token';\n\n    @NgModule({\n        imports: [\n            ...,\n            HttpClientModule,\n            AngularTokenModule.forRoot({\n              ...\n            })\n        ],\n        declarations: [ ... ],\n        bootstrap:    [ ... ]\n    })\n    ```\n\n3. (Maybe Optional) Fix injection context runtime error\nAfter installing this package, if you get an `Error: inject() must be called from an injection context` when running your app, add the following to your typescript path config in the `tsconfig[.app].json` file:\n    ```json\n    \"paths\": {\n      \"@angular/*\": [ \"./node_modules/@angular/*\" ]\n    }\n    ```\n\n## Use\n\n1. Register your user\n    ```javascript\n    constructor(private tokenService: AngularTokenService) { }\n\n    this.tokenService.registerAccount({\n        login:                'example@example.org',\n        password:             'secretPassword',\n        passwordConfirmation: 'secretPassword'\n    }).subscribe(\n        res =\u003e      console.log(res),\n        error =\u003e    console.log(error)\n    );\n    ```\n\n2. Sign in your user\n    ```javascript\n    constructor(private tokenService: AngularTokenService) { }\n\n    this.tokenService.signIn({\n        login:    'example@example.org',\n        password: 'secretPassword'\n    }).subscribe(\n        res =\u003e      console.log(res),\n        error =\u003e    console.log(error)\n    );\n    ```\n\n3. Now you can use HttpClient to access private resources\n    ```javascript\n    constructor(http: HttpClient) { }\n\n    this.http.get('private_resource').subscribe(\n        res =\u003e      console.log(res),\n        error =\u003e    console.log(error)\n    );\n    ```\n\n## Contributors\n\n| [\u003cimg src=\"https://avatars3.githubusercontent.com/u/11535793?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003eJan-Philipp Riethmacher\u003c/sub\u003e](https://github.com/neroniaky) | [\u003cimg src=\"https://avatars.githubusercontent.com/u/7848606?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003eArjen Brandenburgh\u003c/sub\u003e](https://github.com/arjenbrandenburgh)\n| :---: | :---: |\n\n### License\nThe MIT License (see the [LICENSE](https://github.com/neroniaky/angular-token/blob/master/LICENSE) file for the full text)\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneroniaky%2Fangular-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneroniaky%2Fangular-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneroniaky%2Fangular-token/lists"}