I am new to OpenID and Angular, and am trying to make use of the angular-auth-oidc-client
package. There are some great examples by damienbod and elanderson, but I can't even seem to get off the starting block.
After installing the package, all I have to do is inject the OidcSecurityService
- I don't have to use it even - and I am getting a runtime error:
StaticInjectorError(AppModule)[OidcSecurityService -> OidcDataService]:
StaticInjectorError(Platform: core)[OidcSecurityService -> OidcDataService]:
NullInjectorError: No provider for OidcDataService!
...
My natural thought was to import OidcDataService
and add it to the providers, but that results in a compiler error:
ERROR in src/app/app.module.ts(3,31): error TS2305:
Module '"<...>/auth-test/node_modules/angular-auth-oidc-client/index"'
has no exported member 'OidcDataService'.
My Google-fu has uncovered nothing that appears relevant, and it is blocking so early in the process of integrating the package, that I must be making a bad assumption somewhere about how to link everything together. Can anyone see it?
Reproducing
I can reproduce with a minimal project. Create the project with these steps:
ng new auth-test
npm install angular-auth-oidc-client --save
Then add the Oidc services so that app.module.ts
looks like this:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { OidcSecurityService } from 'angular-auth-oidc-client';
import { AppComponent } from './app.component';
@NgModule({
declarations: [ AppComponent ],
imports: [ BrowserModule ],
providers: [ OidcSecurityService ],
bootstrap: [ AppComponent ]
})
export class AppModule {
constructor(
private oidcSecurityService: OidcSecurityService
) {
// I would configure my STS Server, etc, if I could just get past this bug.
}
}
Then just serve it up and view the console for the runtime error.
ng serve