bot composer - publish to Azure - Unexpected token E in JSON at position 0 - azure-bot-service

trying to publish my bot to azure via composer. Already got Azure resource group and Web App Bot created. When I try to publish selected profile in composer i get this error:
Unexpected token E in JSON at position 0
My configuration:
{
"accessToken": "<My Token>",
"hostname": "<My web app bot name>",
"settings": {
"MicrosoftAppId": "<app id>",
"MicrosoftAppPassword": "<app password>"
}
}
Trying to follow this guide: https://learn.microsoft.com/en-us/composer/how-to-publish-bot#deploy-bot-to-azure
Not sure if problem is in syntax or in Azure.
Thank you for any help!

Related

App resource defined in manifest and iframe origin do not match

I've created an ms teams app, that works fine if i launch it locally, however when i install the appackage in my team and launch the app, it shows me the following error in the console:
App resource defined in manifest and iframe origin do not match.
my app in azure AD has been configured for multitenancy, with a unique id. And i've added webApplicationInfo object in the manifest file:
",
"webApplicationInfo": {
"id": "bae.....a8",
"resource": "https://xxxxx.onmicrosoft.com/ba.....a8"
}"
i tried changing the resource object form https from the manifest and azure to api://, it didnt work, i've also added the query "inTeamsSSO=true" to my static tab. Static tab scopes are: "Team"
how do i fix this issue?
Please verify the contents of webApplicationInfo section:
"webApplicationInfo": {
"id": "{AAD App client id}",
"resource": "api://{Your tab app domain}/{AAD App client id}"
}
Please make sure the domain in webApplicationInfo is same as your tab app's domain, otherwise Teams will return error.

Getting authorization token-key for my google service account

I actually want to reply my google play app's comments using this api:
https://developers.google.com/android-publisher/reply-to-reviews#gaining_access
But in here, it wants me to enter auth_token. First i added service account to my google play. After that, i created a key and i downloaded the json file for my key. Using this json file i tried to get auth. token but output of this code tells me that credentials are invalid and token is "none". I wanna solve this problem. Thanks.
from google.oauth2 import service_account
import googleapiclient.discovery
SCOPES = ['https://www.googleapis.com/auth/cloud-platform',
'https://oauth2.googleapis.com/token',
'https://accounts.google.com/o/oauth2/auth',
'https://www.googleapis.com/oauth2/v1/certs',
'https://www.googleapis.com/robot/v1/metadata/x509/myusername.gserviceaccount.com']
SERVICE_ACCOUNT_FILE = 'service.json'
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
print(credentials._token_uri)
print(dir(credentials))
print(credentials.valid)
print(credentials.token)
Resources that i researched:
https://developers.google.com/identity/protocols/oauth2#serviceaccount
https://developers.google.com/identity/protocols/oauth2/service-account#python_1
https://developers.google.com/android-publisher/reply-to-reviews#gaining_access
Note: Also people are sending their API requests like this:
service = build('drive', 'v3', credentials=credentials)
For example above code is for sending api request for google drive. How can i api for my purpose? For example i wanna access google play api using "build".
The key to the build method is that first it takes the API then it takes the version of the api you want to access followed by your credentials.
service = build('drive', 'v3', credentials=credentials)
If you check Discovery services you will find a list of all google apis
The entry for android publisher is as follows
{
"kind": "discovery#directoryItem",
"id": "androidpublisher:v3",
"name": "androidpublisher",
"version": "v3",
"title": "Google Play Android Developer API",
"description": "Lets Android application developers access their Google Play accounts.",
"discoveryRestUrl": "https://androidpublisher.googleapis.com/$discovery/rest?version=v3",
"icons": {
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
},
"documentationLink": "https://developers.google.com/android-publisher",
"preferred": true
},
Which means that the following should be what you are looking for.
service = build('androidpublisher', 'v3', credentials=credentials)

Azure AD enterprise application provisioning

I am facing issues while provisioning Java application in Azure AD enterprise application. I have created SCIM api as per the azure documents but still I am getting below error.
Error code: SystemForCrossDomainIdentityManagementCredentialValidationUnavailable
Details: We received this unexpected response from your application: An HTTP/404 Not Found response was returned rather than the expected HTTP/200 OK response. To address this issue, ensure that the tenant URL is correct. The tenant URL is usually in a format like: https://<>/scim. If this does not resolve the issue, contact the application developer to ensure their SCIM endpoint conforms with the protocol https://www.rfc-editor.org/rfc/rfc7644#section-3.4.2 Please check the service and try again.
You would need to ensure your response is formatted like in section 3.4.2 for the RFC
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 0,
"Resources": [],
"startIndex": 1,
"itemsPerPage": 20
}
https://learn.microsoft.com/en-us/azure/active-directory/app-provisioning/use-scim-to-provision-users-and-groups#response-3

Chatbot is not working once created the Web App bot in Azure bot service

I created a Web app bot in Azure portal. LUIS, App service, Insights got created automatically. This is a Basic bot using SDK-V4. It got created successfully. But after it when i tried to test the bot using "Test in Web Chat" it gave the "Failed to send activity: bot returned an error". I didn't even deployed any code for the bot.
PFB the screenshot of the issue below.
I just downloaded the bot source code and did some changes. It is working fine in Emulator by getting connected to LUIS. But in "Test using web chat" it is not working even with or without deployment of code.
I checked the following already:
Message Endpoints.
MS App ID and MS App Password in App service.
Actual getting results:
In App Insights:
Message : POST to SAP_Bot-DEV failed: POST to the bot's endpoint failed with
HTTP status 500 POST to the bot's endpoint failed with HTTP status
500.
Failed Message: Microsoft.Bot.ChannelConnector.BotAPI.ThrowOnFailedStatusCode
Call Stack:
Microsoft.Bot.Schema.BotException:
at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)
Inner exception System.Exception handled at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext:
at Microsoft.Bot.ChannelConnector.BotAPI.ThrowOnFailedStatusCode (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)
at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)
In Browser:
{error: {code: "BotError", message: "Failed to send activity: bot returned an error"},…}
error: {code: "BotError", message: "Failed to send activity: bot returned an error"}
httpStatusCode: 500[In Browser][1]
[App Insights Screenshot][2]
Try publishing your bot and check if the messaging endpoint url is not set to localhost but to your published url in azure and in registration portalset your messaging endpoint as the redirect url
The issue got resolved. Initially we created the MS application ID and password manually by creating an application in azure portal. There was some issue with the manually created ID, then we tried with automatic app ID creation (after getting required authorization in azure portal) and it works. Thank you all for your support.

BotFramework Emulator Refresh access token failed with status code: 500

Following the article https://blog.botframework.com/2017/06/19/Load-Testing-A-Bot/ to test a bot.
Im trying to get an accessToken, but Im getting a 500. The same is happening if I run the Emulator from code. The downloaded emulator works fine.
{
"error": "server_error",
"error_description": "AADSTS70002: Error validating credentials.\r\nTrace ID: 06f655dd-dc88-49ec-a429-1c86fc1a1b00\r\nCorrelation ID: 070d67cc-361f-45ad-a0bb-d07d5d1e73f4\r\nTimestamp: 2017-07-31 00:54:46Z",
"error_codes": [
70002
],
"timestamp": "2017-07-31 00:54:46Z",
"trace_id": "06f655dd-dc88-49ec-a429-1c86fc1a1b00",
"correlation_id": "070d67cc-361f-45ad-a0bb-d07d5d1e73f4"
}
The process to get the access token is to post to https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token with
x-www-form-urlencoded values:
grant_type=client_credentials
client_id= <YOUR MSA APP ID>
client_secret = <YOUR MSA APP SECRET>
scope = <YOUR MSA APP ID>/.default
Note: a locally built version of the Emulator, with a fresh clone, also has the same issue, while the downloaded version connects correctly
The latest master on Emulator is breaking the access token request. You need to checkout the commit 4923221 to make it work.
To get the access token directly with a post request: the post url is https://login.microsoftonline.com/common/oauth2/v2.0/token , and the scope is https://graph.microsoft.com/.default
The rest should be as specified previously

Resources