Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class WebApiConfig
- {
- public static void Register(HttpConfiguration config)
- {
- ...
- var cors = new EnableCorsAttribute("*", "*", "*");
- config.EnableCors(cors);
- ...
- }
- }
- loginUser(username: string, password: string) {
- let serviceURL = 'http://myurl/token';
- let body = 'username=' + username + '&password=' + password + '&grant_type=password';
- let headers: Headers = new Headers();
- headers.append('Content-Type', 'application/x-www-form-urlencoded');
- let options: RequestOptions = new RequestOptions({
- headers: headers
- });
- return this.http.post(serviceURL, body, options)
- .map(res => this.extractData(res))
- .catch(this.handleError);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement