Hello
I was just wondering if it's possible to get access token using js?? If yes would be possible show me sample
var getAccessToken = function () { return new Promise(function (resolve, reject) { var url = 'https://login.microsoftonline.com/common/oauth2/token'; var username = 'login'; // Username of PowerBI "pro" account - stored in config var password = 'password'; // Password of PowerBI "pro" account - stored in config var clientId ='id' // Applicaton ID of app registered via Azure Active Directory - stored in config var headers = { 'Content-Type': 'application/x-www-form-urlencoded' }; var formData = { grant_type: 'password', client_id: clientId, resource: 'https://analysis.windows.net/powerbi/api', scope: 'openid', username: username, password: password }; console.log(request.post) request.post({ url: url, form: formData, headers: headers }, function (err, result, body) { console.log(result); }) }); }
This what I tried to make but I alsway has problem