Open jonathaneckman opened 8 years ago
when you look to the 'index' file (aurelia-auth.js) you will see that the Authentication class is not exported. I guess that's the reason why you can't import it, no?
import {AuthService} from './auth-service';
import {AuthorizeStep} from './authorize-step';
import {FetchConfig} from './auth-fetch-config';
import {BaseConfig} from './base-config';
import {AuthFilterValueConverter} from './auth-filter';
export function configure(aurelia, configCallback) {
aurelia.globalResources('./auth-filter');
let baseConfig = aurelia.container.get(BaseConfig);
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(baseConfig);
}
}
export {
AuthFilterValueConverter,
AuthService,
AuthorizeStep,
BaseConfig,
FetchConfig
};
Having a similar issue. The reason I am trying to import Authentication is because this is where setToken() is. How would one go about "Supplying token programmatically" without this?
Oh, never mind. I got it working with the following.
this.authService.auth.setToken(token, redirect);
Shouldn't Authentication be exported as part of the node_module though? The example in the docs under "What exactly is 'configured' on the Http Client and can we have multiple endpoints?" point to using the auth.TokenInterceptor so that you can configure the rest of the settings yourself, however because Authentication isn't exported we can't import { Authentication } from 'aurelia-auth'. (On that note the documentation is wrong as well as it injects AuthService into auth which doesn't contain a TokenInterceptor method).
The sample app works fine because it is using all of the files from the library in a local context, however when using the library via npm this just doesn't work.
Trying to do this:
import {Authentication} from 'aurelia-auth';
will give the following error: