I know that one of the major steps in power bi embedded is to give your app permission to it (I have an existing app in azure ad) but what if I'm just trying to get it working on localhost!
Here's my code: and nothing is working. Getting 403 currently.
**for testing purposes, I retreived my access token via: https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/reports-generate-token-in-group#code-try-0
<PowerBIEmbed
embedConfig={{
type: 'report', // Supported types: report, dashboard, tile, visual and qna
id: 'myreportId',
embedUrl:
'https://embedded.powerbi.com/appTokenReportEmbed?reportId=myreportid',
accessToken:
'xxx',
permissions: models.Permissions.All,
tokenType: models.TokenType.Embed,
viewMode: models.ViewMode.View,
settings: {
panes: {
filters: {
expanded: false,
visible: false,
},
},
background: models.BackgroundType.Transparent,
},
}}
eventHandlers={
new Map([
[
'loaded',
function() {
console.log('Report loaded');
},
],
[
'rendered',
function() {
console.log('Report rendered');
},
],
[
'error',
function(event) {
console.log(event.detail);
},
],
])
}
cssClassName="report-style-class"
getEmbeddedComponent={embeddedReport => {
console.log({ embeddedReport });
// this.report = embeddedReport as Report;
// window.report = this.report;
}}
/>
It seems like you are using the wrong tokenType
You need to use tokenType: models.TokenType.Aad
For more information regarding tokenType, you can check this documentation: https://learn.microsoft.com/javascript/api/overview/powerbi/embedding-solutions
If this does not resolve the problem, there may be other causes of error 403.:
• The user has exceeded the amount of embedded token that can be generated on a shared capacity.
• The Azure AD auth token expired.
• The authenticated user isn't a member of the group (workspace).
• The authenticated user isn't an admin of the group (workspace).
• The authenticated user doesn't have permissions. Permissions can be updated using refreshUserPermissions API
• The authorization header may not be listed correctly. Make sure there are no typos.
Reference:
https://learn.microsoft.com/power-bi/developer/embedded/embedded-troubleshoot
Related
I'm trying to setup SignInWithApple on my webpage. Currently there is the basic auth and the google auth. Because of some required fields in my current user pool which not work together with apple, I created a second user pool. Now I am trying to make both of them work by switching the configuration.
manual config (not using the cli for the aws-exports)
export default () => {
return {
default: {
region: process.env.AWS_COGNITO_REGION,
userPoolId: process.env.AWS_COGNITO_USER_POOL_ID_DEFAULT,
userPoolWebClientId: process.env.AWS_COGNITO_APP_CLIENT_ID_DEFAULT,
mandatorySignIn: false,
oauth: {
domain: process.env.AWS_COGNITO_DOMAIN_DEFAULT,
scope: [
'profile',
'phone',
'openid',
'email',
'aws.cognito.signin.user.admin'
],
redirectSignIn: process.env.AWS_COGNITO_REDIRECT_SIGN_IN,
redirectSignOut: process.env.AWS_COGNITO_REDIRECT_SIGN_OUT,
responseType: 'code'
}
},
SignInWithApple: {
region: process.env.AWS_COGNITO_REGION,
userPoolId: process.env.AWS_COGNITO_USER_POOL_ID_APPLE,
userPoolWebClientId: process.env.AWS_COGNITO_APP_CLIENT_ID_APPLE,
mandatorySignIn: false,
oauth: {
domain: process.env.AWS_COGNITO_DOMAIN_APPLE,
scope: ['openid'],
redirectSignIn: process.env.AWS_COGNITO_REDIRECT_SIGN_IN,
redirectSignOut: process.env.AWS_COGNITO_REDIRECT_SIGN_OUT,
responseType: 'code'
}
}
}
}
And then I have a vue component with a Google and Apple login button, triggering the same function but passing either "Google" or "SignInWithApple".
import Amplify, { Auth } from 'aws-amplify'
import amplifyResources from '#/plugins/amplifyResources'
export default {
data() {
return {
bucket: null
}
},
methods: {
federatedAuth(provider) {
if ('SignInWithApple' === provider)
this.bucket = amplifyResources().SignInWithApple
if ('Google' === provider)
this.bucket = amplifyResources().default
Amplify.configure(this.bucket) **RECONFIGURE OF AMPLIFY CONFIG **
Auth.federatedSignIn({ provider })
}
}
}
And I am getting the following error:
34:03.80 AuthError -
Error: Amplify has not been configured correctly.
The configuration object is missing required auth properties.
So the funny thing is, if I init the "default" or "apple" config as a plugin, which I link and load in my nuxt.config.js file, the authentication works. The users are getting registered and logged in. With google on the default user pool auth or with apple at the new user pool. Both work then.
But I am trying to switch the userpool in some component directly, based on the auth method the user is choosing. There I am "reconfiguring" the amplify config with Amplify.configure(this.bucket). From that point I am getting the error message from above. But the config is indeed switching. Otherwise I wouldn't get redirected to apple on the apple button or to google on the google button. Both have completely different configs. So I know the "reconfiguration" is happening. I also know that in general I have the right properties in the default & apple config, since the login for both is working, if I set the config as a plugin in the nuxt.config.js file.
Regarding getting Cookie from my chrome extension, it works perfectly when the chrome setting "On all sites".
But when I set "On [current site]" or "When you click the extension" in chrome extension setting, I couldn't get any cookies..
https://support.google.com/chrome_webstore/answer/2664769?hl=en
"Let extensions read and change site data"
※ When I keep opening the url where I want to get the cookie, it's success...
I tried to look for the solution, but there were nothing.
{
"name": "myapp",
"version": "1.0.0",
"description": "desc",
"permissions": [
"contextMenus",
"tabs",
"cookies"
],
"host_permissions": [ "https://wanna-get-cookie-this-domain.com/*" ],
"background": { "service_worker": "service_worker.js" },
"content_scripts": [
{
"js": ["scripts/contentscript.js"],
"matches": ["https://*/*"]
}
],
"manifest_version": 3
}
service_woeker.js
chrome.contextMenus.create({
id: "testapp",
title: "title",
contexts: ["all"],
type: "normal"
});
chrome.contextMenus.onClicked.addListener(function(info, tab) {
chrome.windows.create({
url: `/views/popup.html`,
type: 'popup',
focused: true,
width: 395, height: 230
});
})
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.type == "getCookie") {
chrome.cookies.getAll({}, function(cookies) {
console.log(cookies);
// "On all sites" works.
// "On [current site]" or "When you click the extension" doesn't work
// even after I clicked and enabled the extension.
});
}
return true;
});
views/popup.html
<html>
...
<script src="/scripts/popup.js"></script>
</html>
scripts/popup.js
// After user clicked, below code
chrome.runtime.sendMessage({type: 'getCookie'}));
Thanks,
This is a bug:
the cookies API is only checking the host permissions, and not checking tab-specific permissions, since the request isn't associated with a tab.
Until it's fixed you'll have add the host permissions for all sites in manifest.json:
"host_permissions": ["<all_urls>"]
Note that your content script already runs on all https sites (why not all sites though?), which means that your extension is already requesting the "broad host permission" under the hood, so adding the same pattern to host_permissions doesn't increase the internal permissions of your extension, it's more of a cosmetic requirement to allow the use of chrome API in the non-content scripts like the background script.
I setup google auth with vue js and aws amplify cognito. On first signIn i get this message
Sign in failure ValidationException: 1 validation error detected: Value '{xxx.amazonaws.com/xxx}' at 'logins' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 50000, Member must have length greater than or equal to 1]
On second signIn(press button) it sign in well.
Why don't work first sign in and why get this message?
Config:
const awsmobile = {
"aws_project_region": "ap-south-1",
"aws_cognito_identity_pool_id": "ap-south-1:25071751-c943-443a-94ab-62c6b0f1c496",
"aws_cognito_region": "ap-south-1",
"aws_user_pools_id": "ap-south-1_NAZCqoylw",
"aws_user_pools_web_client_id": "38a1itpo95f3tgln6vq43u3u4o",
"oauth": {
"domain": "mobileweb-dev.auth.ap-south-1.amazoncognito.com",
"scope": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
//"redirectSignIn": "https://test-kutumbh-app.netlify.app/home",
// "redirectSignOut": "https://test-kutumbh-app.netlify.app",
//"redirectSignIn": "https://dev-kutumbh-app.netlify.app/home",
//"redirectSignOut": "https://dev-kutumbh-app.netlify.app",
"redirectSignIn": "http://localhost:3000/home",
"redirectSignOut": "http://localhost:3000",
"responseType": "code"
},
"federationTarget": "COGNITO_USER_POOLS"
};
export default awsmobile;
enter code here
enter image description here
By default, Amplify will open the Cognito Hosted UI in Safari/Chrome, but you can override that behavior by providing a custom URL opener.
To solve the issue to convert the given URL into the required form using InAppBrowser as suggested in this ISSUE by Ashish-Nanda comment.
Amplify.configure({
...config, oauth: {
...config.oauth,
urlOpener: async function urlOpener(url, redirectUrl) {
await InAppBrowser.isAvailable();
const { type, url: newUrl } = await InAppBrowser.openAuth(url, redirectUrl, {
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: false,
ephemeralWebSession: false,
});
const splitUrl = `myapp://?${newUrl.split("#_=_")[0].split("?")[1] || ''}`;
if (type === 'success') {
Linking.openURL(splitUrl);
}
}
}
})
This is the first time I am trying to embed a Power BI report with React.
I used the following method and it is working fine. But the issue is that my access token failed after nearly one hour. When I run the project after one hour I have to generate a new access code and add it into the following code. What is the solution for this ?
my code -->
<PowerBIEmbed
embedConfig={{
type: 'report',
id: 'xxxxx',
embedUrl: "xxxxx",
accessToken: ' xxxxxxxxx',
tokenType: models.TokenType.Aad,
settings: {
panes: {
filters: {
expanded: false,
visible: false
}
},
background: models.BackgroundType.Transparent,
}
}}
eventHandlers={
new Map([
['loaded', function () { console.log('Report loaded'); }],
['rendered', function () { console.log('Report rendered'); }],
['error', function (event) { console.log(event.detail); }]
])
}
cssClassName={"Embed-container"}
getEmbeddedComponent={(embeddedReport) => {
window.report = embeddedReport;
}}
/>
Thank you
Jeewan
You have to purchase a premium licence.
https://learn.microsoft.com/en-us/power-bi/enterprise/service-premium-features
When using the Google Custom App Publishing API from my NodeJS, I encounter an error
config: [Object: Inspection interrupted prematurely. Maximum call stack size exceeded.],
code: 403,
errors: [
{
domain: 'global',
reason: 'forbidden',
message: 'apkInvalidFile'
}
]
And no much more details about it.
There is a very precise way to create this request. The right way is not documented anywhere and requires some retro-engineering.
Here is what works:
result = await getPlayCustomApp().accounts.customApps.create({
account: 'FIXME entreprise developer account id',
requestBody: {
title: 'Trololo app title',
languageCode: 'en_US',
},
media: {
body: fs.createReadStream('/path/to/app.apk'),
},
});
I hope it helps people not waste their afternoon!