I want to use SSO in Outlook to get the BookstrapToken with MSGrapAccess and I'm getting the error "13012". In the documentation says that this error is only possible while sideloading, but I also get it once I deploy the addin.
I'm not doing anything special:
bootstrapToken = await OfficeRuntime.auth.getAccessToken({ allowSignInPrompt: true, allowConsentPrompt: true, forMSGraphAccess: true });
This is the error I get:
{code: 13012, message: "API is not supported in this platform.", name: "API Not Supported"}
All the permissions are granted in Azure.
Is it possible to get the BootstrapToken foMSGraphAccess or I need to use a different sign in method?
Thank you
I found the way to make it work with the parameter. The problem was that I was using allowConsentPrompt and forMSGraphAccess at the same time. Without allowConsentPrompt, I can use forMSGraphAccess with no problem.
Related
I am having a weird problem with google gapi auth. For some reason, the value for gapi.auth2.getAuthInstance().isSignedIn().get() is always returning false. This is my setup:
gapi.load("auth2", initAuth2);
initAuth2(){
gapi.auth2.init({
client_id: "xxxxx-yyyyy.apps.googleusercontent.com",
hosted_domain: "domain.com",
redirect_uri: "http://localhost:4200",
ux_mode: "redirect",
}).then(performAuth, error=>{
console.error(`Error initiating gapi auth2: ${error.details}`);
});
}
performAuth(googleAuth){
const isSignedIn = googleAuth.isSignedIn.get();
if(!isSignedIn){
googleAuth.signIn();
return;
}
const user = googleAuth.currentUser.get();
console.log(user);
}
I have two google workspace accounts sign in the same chrome profile. When I run this script, I get the prompt to select an account. No matter which one I choose, the flow just keeps looping. The reason for that is that the line const isSignedIn = googleAuth.isSignedIn.get(); is always returning false.
Things I've tried so far:
I thought that maybe the client_id was corrupted so I generated a new one. Same behaviour.
I though the GCP project was corrupted, so I created a new project with new credentials. Same behaviour.
Thought there was an issue with cookies, so I deleted and clear cookies and history. Same behaviour.
Thought is was related only to localhost so I deployed to the web. Same behaviour.
If I change the init options from ux_mode: "redirect" to ux_mode: "prompt". It works. However, that is not the desired experience. Also, if I only have one google workspace in the chrome profile, it works. Even more interesting... if I use a client id from an older project... it works! The problem is that the consent screen shows the wrong app name.
I know this question is similar to this one, however I feel it's different because none of the above troubleshooting works. Any insights?
There is a case for the exact same problem here, it is most likely a bug in the api set
I am trying to send a file (calendar ics file) in the Teams channel. I am using the below code which works fine in webchat channel:
const reminder = fs.readFileSync(`temp/reminder.ics`);
const base64reminder = Buffer.from(reminder).toString('base64');
await dc.context.sendActivity({'text':'Click here to set up a reminder on your calendar', 'attachments': [{
name: 'Leader X Activities',
contentType: 'text/plain',
contentUrl: `data:text/calendar;base64,${ base64reminder }`}]
});
I have used both text/plain and text/calendar, the type there didn't make a difference. But teams is throwing an Unknown attachment type error. Here is what I captured in App Insights.
{"error":"Unknown attachment type","callStack":"Error: Unknown attachment type\n at new RestError (D:\\home\\site\\wwwroot\\node_modules\\#azure\\ms-rest-js\\dist\\msRest.node.js:1399:28)\n at D:\\home\\site\\wwwroot\\node_modules\\#azure\\ms-rest-js\\dist\\msRest.node.js:2495:37\n at <anonymous>\n at process._tickDomainCallback (internal/process/next_tick.js:228:7)","botName":"itInnovationBot"}
I've tried to review the documentation here, but I can't make any sense out of what it's doing with the consent and then send files. It's also using different syntax than I am, probably because it is extending TeamsActivityHandler. I'm doing this inside a waterfall dialog extending ComponentDialog, so I'm not even sure I could utilize that class if I wanted to.
It seems like I need to ask for some sort of consent to send a file, but I can't find any documentation on how to do this. What do I ened to do in order to get this ics file attached in Teams?
I am somewhat interested in doing this directly via Graph API, but I believe we have some internal corporate roadblocks to this, which is why I am trying an initial implementation with ics file attachment. And besides, that would solve only ics files and I know we will need to have the bot send other file types in the future.
EDIT: I've tried a few other things where I've perhaps made a bit of progress, but it's still not working. The below gets rid of the unknown attachment error but it is replaced with empty content error:
await dc.context.sendActivity({'text':'Click here to set up a reminder on your calendar', 'attachments': [{
name: 'Leader X Activities',
contentType: 'application/vnd.microsoft.teams.card.file.info',
contentUrl: `data:text/calendar;base64,${ base64reminder }`}]
});
Adding the content object I just get a "ServiceError/Unknown" error, which isn't very helpful troubleshooting further. I've tried all kinds of different information in the content object all with the same result.
await dc.context.sendActivity({'text':'Click here to set up a reminder on your calendar', 'attachments': [{
name: 'Leader X Activities',
contentType: 'application/vnd.microsoft.teams.card.file.info',
contentUrl: `data:text/calendar;base64,${ base64reminder }`,
content: {
uniqueId: '12345whatever'
contentType: 'text/plain'
}}]
});
EDIT 2: One further update, I've tried setting a consent card, with the assumption that I can then look for an "invoke" activity, but the consent buttons don't seem to actually generate any activity. Here's the code:
await dc.context.sendActivity({'attachments': [{
content: {
description: 'Here is the file I want to send you',
fileSizeInBytes: fileSizeInBytes,
accetpContext: fileContext,
declineContext: fileContext
},
contentType: 'application/vnd.microsoft.teams.card.file.consent',
name: 'reminder.ics'}]
})
EDIT 3: I didn't get any message or indication of activity from desktop app, but when I tried to click on the consent buttons from mobile app it was giving me a "BOTNAME does not support files" error message, even though in the teams app manifest I do have it set to support files. So it seems I'm not getting an activity because that button press is getting blocked. Not sure if this is because I am not using TeamsActivityHandler (and if that is required, then I will need to know how to incorporate that into a waterfall dialog that is using ComponentDialog).
We have a bot running in Azure (Web App Bot) that I'm trying to embed on a website. The bot is based of the Bot Builder V4 SDK Tamplate CoreBot v4.9.2. At first I used the iframe to embed the bod. This worked but didn't provide the features we need, so now im changing it to use DirectLine.
My code on the webpage looks like this:
<script crossorigin="anonymous"
src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<div id="webchat" role="main"></div>
<script>
(async function () {
const res = await fetch('https://[my bot name here].azurewebsites.net/.bot/v3/directline/tokens/generate',
{
method: 'POST',
headers: new Headers({
'Authorization': "Bearer [my token here]"
})
});
const { token } = await res.json();
window.WebChat.renderWebChat(
{
directLine: await window.WebChat.createDirectLineAppServiceExtension({
domain: 'https://[my bot name here].azurewebsites.net/.bot/v3/directline',
token
})
},
document.getElementById('webchat')
);
document.querySelector('#webchat > *').focus();
})().catch(err => console.error(err));
</script>
After some struggles I managed to fetch a token from https://[my bot name here].azurewebsites.net/.bot/v3/directline.
And I can see the chat window on my webpage, but is says connecting for a while then it changes to Taking longer than usual to connect, like this:
In the Chrome console there is an error saying Failed to connect Error: Connection response code 500. When I check Chrome's Network tab I can see that the token generated completed with status 200 and that the websocket connection is open, like this:
----------EDIT---------
I just noticed that when go to https://[my bot name here].azurewebsites.net/.bot using a webbrowser, the resulting json is
{"v":"1.0.0.0.55fa54091a[some key?]","k":true,"ib":false,"ob":false,"initialized":true}
ib and ob should be true but are false, maybe this is part of the problem.
----------EDIT 2---------
OK so now I'm starting to go crazy.
Ashish helped me and at some point the ib and ob were true. They were true for most of yesterday. At some point yesterday they turned false for a short while (no more than 2 hours). I checked if someone had triggered the release pipeline but no recent releases. After that ib and ob magically turned true again and connecting to the direct line worked again.
Now this morning ib and ob were false again. And again no recent releases. I don't know what is causing this.
Does anybody know what's going on here or how to fix this? How do I find what causes ib and ob to be false?
Any help is appreciated! Thanks in advance. If you need more information, just ask and I'll post it.
If the ib and ob values displayed by the *.bot endpoint are false this means the bot and the Direct Line app service extension are unable to connect to each other.
Make sure you verify below things:
Double check the code for using named pipes has been added to the
bot.
Confirm the bot is able to start up and run at all. Useful
tools are Test in WebChat, connecting an additional channel, remote
debugging, or logging.
Restart the entire Azure App Service the bot
is hosted within, to ensure a clean start up of all processes.
Please check troubleshooting guide, it seems updated today. (still old date reflected some how, not sure why)
I have been trying to create a Firefox add-on using the web extensions API. My add-on should take a screenshot of the current page the user is browsing using chrome.tabs.captureVisibleTab but it returns undefined. They say that its already implemented in the API on http://arewewebextensionsyet.com/ but I can't seem to get it to work.
Here is my code:
chrome.tabs.captureVisibleTab(null, {}, function(data) {
console.log("screenshotData: " + data);
});
I have also tried passing in a window.id as the first parameter even though in the docs it says its optional, but this also returns an undefined value for data.
Does anyone have any experience with this in particular?
It works for me in Nightly 49.0a1 (2016-06-04).
Make sure you have the following permission in your manifest.json file:
"permissions": [ "<all_urls>" ]
We have multiple marketplace Apps that use Gmail Contextual Gadgets. These have been running for years successfully.
We are now noticing the following intermittent error being thrown when calling out to an external web server using open social osapi.http.post
"{"id":"http.post","error":{"message":"Response not valid JSON","code":406}}"
We have checked and there is nothing wrong with our server. We can make the call directly to our server successfully without fail.
We can replicate the issue calling to multiple servers running different apps/gadgets. The only commonality appears to be the use of osapi.http.post.
Here is the post
osapi.http.post({
'body': postdata,
'href': serverUrl + 'iLinkStreamer.ashx?data=' + "" + setTimeStamp() + debugString,
'format': 'json',
'authz': 'signed',
'noCache': true
}).execute(displayStreamList);
which raises the 406 error as above
Has anybody else noticed this issue?? Not sure how we can address it?
I had the same issue for a while and finally found the problem. I was also invoking external resources using osapi.http.post. I read the new documentation and found that there is a new way to do the same.
Check this url for more details, but the idea is that now you'll need to use makeRequest API, it will look something like this:
var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
gadgets.io.makeRequest("https://your.backend.com", on_response_function, params);
...
def on_response_function(response){ ... }
I hope this helps someone.
I'm not sure if I'm the only one, but I never received a notification message that the previous API will be deprecated. :(