
getToken(){
var httpHeader = new HttpHeaders({
"Content-Type": "application/x-www-form-urlencoded",
// "Access-Control-Allow-Origin": "*",
})
//
const body = new URLSearchParams();
body.set('grant_type','client_credentials' )
body.set('client_id', environment.Ad_directory.clientId)
body.set('client_secret', environment.Ad_directory.clientSecret)
body.set('resource', environment.Ad_directory.resource);
const headers = new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' });
console.log(body.toString())
return this.http.post("https://login.microsoftonline.com/"+environment.Ad_directory.tenantId +"/oauth2/token",body.toString(), { headers, observe: 'response' })
}
}