Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find namespace 'adal' #3

Closed
brndoko opened this issue May 31, 2017 · 4 comments
Closed

Cannot find namespace 'adal' #3

brndoko opened this issue May 31, 2017 · 4 comments

Comments

@brndoko
Copy link

brndoko commented May 31, 2017

I followed your instructions to reproduce the project and on my app.component.ts when I attempt to use:

const config: adal.config = {}

It says it cannot find the namespace 'adal'. Do you have any idea of why this might occur? Is there something else I need to install in the project?

Any help you can offer would be much appreciated. Thanks so much!

@brndoko
Copy link
Author

brndoko commented May 31, 2017

So, I solved this by adding the adal.d.ts file. I am attempting to allow someone to specify a tenant and client id as the endpoints in my app. So, I attempted to put the service configuration and initialization in a separate component from the app component and only initialize after receiving user input from a form. However, this doesn't seem to be working:

export class AuthAzureComponent implements OnInit {

constructor(private service: Adal4Service, private http: Adal4HTTPService) { }

ngOnInit() {
}

onSubmit(form: NgForm) {

const config: adal.Config = {                        
    tenant: form.value.tenant,                      
    clientId: form.value.clientId   
} 

this.service.init(config);

this.service.login();

console.log('username ' + this.service.userInfo.username);

console.log('authenticated: ' + this.service.userInfo.authenticated);

console.log('name: ' + this.service.userInfo.profile.name);

console.log('token: ' + this.service.userInfo.token);

console.log(this.service.userInfo.profile);

}

}

Am I approaching this incorrectly with your wrapper? I'm new to Angular, so any help would be appreciated. Thanks!

@seanuleh
Copy link

seanuleh commented Jun 4, 2017

Hey Brandon,

I am getting the same error you mentioned. Can you explain further how you got passed it? What are the contents of the adal.d.ts file you added?

@erikholmgren
Copy link

You just need to add an import statement in app.component:
import { adal } from 'adal-angular';

This worked for me.

@benbaran
Copy link
Owner

This doesn't always seem to happen, but erikholmgren's solutions works when it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants