{"_id":"@edgeflare/ngx-oidc","_rev":"2-91bf8e0ce7929747baa7be827de74582","name":"@edgeflare/ngx-oidc","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@edgeflare/ngx-oidc","version":"0.0.1","keywords":["angular","oidc","oauth2","capacitor"],"author":{"name":"dev@edgeflare.io","email":"dev@edgeflare.io"},"license":"Apache-2.0","_id":"@edgeflare/ngx-oidc@0.0.1","maintainers":[{"name":"edgeflareio","email":"npm@edgeflare.io"}],"dist":{"shasum":"c68d94127eac029b91bf92731f51516d84322678","tarball":"https://registry.npmjs.org/@edgeflare/ngx-oidc/-/ngx-oidc-0.0.1.tgz","fileCount":5,"integrity":"sha512-MODl7YEt/8K2yysB2reo/zHfpjvcs1Kp3STRqEgHKFvLlqNsb10kWBQl1yujK5G0h9QgBvqmv0gXup+LoQPZtQ==","signatures":[{"sig":"MEUCIGZONuTAtCbbrwSWwYYC77mQIUr3bXyNidUvb1s4VbEBAiEArPvFeitBFKxbt84gOFjeIrqgkXzshLmX7WzPhJeKOOw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71479},"module":"fesm2022/edgeflare-ngx-oidc.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/edgeflare-ngx-oidc.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"f193f9259958b3a5a23173c9323aa09bdcc2ff44","typings":"index.d.ts","_npmUser":{"name":"edgeflareio","actor":{"name":"edgeflareio","type":"user","email":"npm@edgeflare.io"},"email":"npm@edgeflare.io"},"_npmVersion":"11.4.2","description":"oidc-client-ts wrapper for Angular and Capacitor","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":">=17.0.0","@angular/common":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-oidc_0.0.1_1751591863863_0.13932566627489473","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@edgeflare/ngx-oidc","version":"0.0.2","peerDependencies":{"@angular/common":">=17.0.0","@angular/core":">=17.0.0","@angular/router":">=17.0.0","oidc-client-ts":"^3.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"license":"Apache-2.0","description":"oidc-client-ts wrapper for Angular and Capacitor","keywords":["angular","oidc","oauth2","capacitor"],"author":{"name":"dev@edgeflare.io","email":"dev@edgeflare.io"},"repository":{"type":"git","url":"git+https://github.com/edgeflare/ngx-oidc.git"},"homepage":"https://github.com/edgeflare/ngx-oidc#readme","bugs":{"url":"https://github.com/edgeflare/ngx-oidc/issues"},"module":"fesm2022/edgeflare-ngx-oidc.mjs","typings":"types/edgeflare-ngx-oidc.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./types/edgeflare-ngx-oidc.d.ts","default":"./fesm2022/edgeflare-ngx-oidc.mjs"}},"gitHead":"d6aac6023ff1005cca8ffd5fe5406cc0214b2e59","_id":"@edgeflare/ngx-oidc@0.0.2","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-uF+4rF1IBco/Auz8GPdtfvhOaoJiEnbmWHAGom5EGYmPdQ3msPoO7sYaV6hSLb/NpqBEczUbchgIUiYjmUw3dw==","shasum":"3b831a33f34e4579aad7e2d196921007893aa7cb","tarball":"https://registry.npmjs.org/@edgeflare/ngx-oidc/-/ngx-oidc-0.0.2.tgz","fileCount":5,"unpackedSize":71679,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBKkpoY0veJlpJ57t4qnmzaUGpsIn1bUDRFE/V6CNs42AiEA2w5XKTQv+AMYcnIEXxYbMrmtI50HhXuR0I3Em62RqEs="}]},"_npmUser":{"name":"edgeflareio","email":"npm@edgeflare.io"},"directories":{},"maintainers":[{"name":"edgeflareio","email":"npm@edgeflare.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ngx-oidc_0.0.2_1765670948074_0.6303093094311092"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-04T01:17:43.747Z","modified":"2025-12-14T00:09:08.438Z","0.0.1":"2025-07-04T01:17:44.078Z","0.0.2":"2025-12-14T00:09:08.222Z"},"author":{"name":"dev@edgeflare.io","email":"dev@edgeflare.io"},"license":"Apache-2.0","keywords":["angular","oidc","oauth2","capacitor"],"description":"oidc-client-ts wrapper for Angular and Capacitor","maintainers":[{"name":"edgeflareio","email":"npm@edgeflare.io"}],"readme":"# [oidc-client-ts](https://github.com/authts/oidc-client-ts) wrapper for Angular and Capacitor\n\n![signin demo](https://raw.githubusercontent.com/edgeflare/ngx-oidc/main/demo.gif?raw=true)\n\n## 1. Install\n```shell\nnpm install oidc-client-ts @edgeflare/ngx-oidc\n```\n\n## 2. Configure Angular\nUpdate `<approot>/src/app/app.config.ts`. The [example](https://github.com/edgeflare/ngx-oidc/tree/main/example) directory includes a minimal app.\n\n```ts\nimport { ApplicationConfig } from '@angular/core';\nimport { provideRouter, Route } from '@angular/router';\nimport { UserManagerSettings } from 'oidc-client-ts';\nimport { initOidc, OIDC_ROUTES } from '@edgeflare/ngx-oidc';\n\n// Define OIDC configuration\nconst oidcConfig: UserManagerSettings = {\n  authority: \"http://127.0.0.1:5556/dex\",\n  client_id: \"public-webui\",\n  redirect_uri: \"http://localhost:4200/signin/callback\",\n  response_type: \"code\",\n  scope: \"openid profile email offline_access audience:server:client_id:oauth2-proxy\", // extra scopes for Dex\n  post_logout_redirect_uri: \"http://localhost:4200/signout/callback\",\n  automaticSilentRenew: true,\n  silentRequestTimeoutInSeconds: 30,\n  silent_redirect_uri: \"http://localhost:4200/silent-refresh-callback.html\",\n};\n\n// Provide OIDC configuration and routes in the application configuration\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    // other providers\n    ...initOidc(oidcConfig),\n    provideRouter(OIDC_ROUTES), // before application routes\n    provideRouter(routes)\n    // more providers\n  ],\n};\n```\n\n**For [Capacitor](https://github.com/ionic-team/capacitor) based native mobile apps**\n\n```sh\nnpm install @capacitor/core oidc-client-ts @edgeflare/ngx-oidc @edgeflare/ngx-oidc-capacitor\n```\n\n```ts\nimport { UserManagerSettings, WebStorageStateStore } from 'oidc-client-ts';\nimport { initOidc, OIDC_ROUTES, CapacitorStateStore } from '@edgeflare/ngx-oidc-capacitor';\nimport { Capacitor } from '@capacitor/core';\n\nconst oidcConfig: UserManagerSettings | any = {\n  // Android requires issuer/authority endpoint to be HTTPS\n  authority: 'https://iam.example.org', // https://keycloak.example.org/realms/<realmname>\n  client_id: 'public-webui',\n  redirect_uri: Capacitor.isNativePlatform()\n    ? 'org.example.capdemo://signin/callback'\n    : `${window.location.origin}/signin/callback`,\n  post_logout_redirect_uri: Capacitor.isNativePlatform()\n    ? 'org.example.capdemo://signout/callback'\n    : `${window.location.origin}/signout/callback`,\n  response_type: 'code',\n  scope: 'openid profile email offline_access audience:server:client_id:oauth2-proxy',\n  automaticSilentRenew: true,\n  // Use the appropriate storage based on platform\n  userStore: Capacitor.isNativePlatform()\n    ? new CapacitorStateStore() // consider github.com/martinkasa/capacitor-secure-storage-plugin for sensitive (eg banking) apps\n    : new WebStorageStateStore({\n      store: window.localStorage\n    }),\n  loadUserInfo: true,\n};\n```\n\nIf using Capacitor, ensure all imports are from `@edgeflare/ngx-oidc-capacitor`, instead of `@edgeflare/ngx-oidc`. See [example-capacitor](./example-capacitor) app.\n\n*Providing* `OIDC_ROUTES` registers below routes:\n\n- `/signin/{callback,error,''}`\n- `/signout/callback`\n- `/oidc-profile`, protected by an `authGuard` supplied with `ngx-oidc`\n\nSee `signinRedirect`, `signinPopup` etc examples at [http://localhost:4200/signin](http://localhost:4200/signin). It additionally provides `user` and `isAuthenticated` signals; which can be called like `user()` to get the current user, and `isAuthenticated()` to check if the user is authenticated.\n\nThe routes can be registered on parent routes other root `/`, with ngx-oidc supplied components or your own.\n\n```ts\nconst myOidcRoutes: Route[] = [\n  // signin is now at /account/signin\n  { path: 'account', loadChildren: () => import(\"@edgeflare/ngx-oidc\").then((m) => m.OIDC_ROUTES)},\n  // Or just the only required route. must match the `redirect_uri` in oidcConfig\n  { path: 'signin-callback', loadComponent: () => import(\"@edgeflare/ngx-oidc\").then((m) => m.SigninCallbackComponent)},\n];\n\n// ...\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    ...initOidc(oidcConfig),\n    provideRouter(myOidcRoutes),\n  ],\n};\n```\n\n## Features\n- [x] signinRedirect, signinPopup, signoutRedirect, signoutPopup\n- [x] authGuard using canActivateFn\n- [x] [Capactior](https://github.com/ionic-team/capacitor) support for native mobile apps\n\n## Contributing / Development\n\nWith ~200 lines of code ngx-oidc doesn't really do much except calling oidc-client-ts functions. It sets up and exposes oidc-client-ts' [UserManager](https://authts.github.io/oidc-client-ts/classes/UserManager.html) functions through an Angular service, AuthService. The function signatures used in this service are the same as those provided by `oidc-client-ts` *e.g.*:\n\n- `signinRedirect(args?: SigninRedirectArgs): Promise<void>`\n- `signinPopup(args?: SigninPopupArgs): Promise<User>`\n- `signinSilent(args?: SigninSilentArgs): Promise<null | User>`\n\nFor advanced usage, access the underlying oidc-client-ts' UserManager instance with `AuthService.userManagerInstance`. If you wanna make it better, please do! Fork the repo, make your changes, and submit a PR.\n\n```sh\nnpx ng build ngx-oidc\nnpx ng build ngx-oidc-capacitor\n```\n\n## License\nApache License 2.0\n","readmeFilename":"README.md","homepage":"https://github.com/edgeflare/ngx-oidc#readme","repository":{"type":"git","url":"git+https://github.com/edgeflare/ngx-oidc.git"},"bugs":{"url":"https://github.com/edgeflare/ngx-oidc/issues"}}