Trying to run the sample from Azure-Samples/digital-twins-samples.
It is failing here in this code
client.GetDigitalTwin("---");
I have entered the required credentials in the authentication window and it gives an exception saying "InteractiveBrowserCredential Authentication Failed".
Inner Exception - "Only loopback redirect uri is supported, but urn:iet:wg:oauth:2.0:oob was found." Configure http://localhost or http://localhost:port both during app registration and when you create the PublicClientApplication object. See https://aka.ms/msal-net-os-browser for details
I have verified whether the role "Azure Digital Twins Owner (Preview)" is present for my user id and I am able to view/update the models & twins in the digital explorer sample from this example ADT explorer, but unable to update model through code. I believe there is some configuration missing in the reply url of the desktop/web url.
Any idea how to fix this issue.
After discussing directly on this issue, we observed that the Internet Explorer on Client Machine is causing/experiencing some blocking on pop-ups.
Resolution 1:
Please check if there are any pop-up blockers enabled on the browser.
Please change the default browser to another browser [like chrome]
and re-try.
Clear the browser cache and close all opened browser sessions.
Restart VS2019 and try to run the sample code.
Resolution 2:
Make sure you are using Azure.Identity latest NuGet Package. As of today 09/02/2020 the working version is Azure.Identity 1.2.2
Resolution 3:
Please make sure the AAD Application Authentication has a 'Mobile & Desktop Application' Platform added, along with the redirect URL.
For more information please visit this Github issue:
I know for Alexa account linking user need to create his security profile in amazon developer and after that, a user needs to setup account linking in Alexa developer console for google sign in with Alexa skill. But now the question is how can user test the Alexa account linking without publishing that skill? because my skill is still in development and I want to check google sign in with Alexa in my developer console! So Is it possible to do? And if it is possible then please guide me how can I do that!
I am using python-ask for Alexa and for google sign in we need access token and I could not get access token in it! Here is my code:
from ask_sdk_core.skill_builder import SkillBuilder
from alexa.data import MORNING_WISHES
sb = SkillBuilder()
#sb.request_handler(can_handle_func=is_intent_name("MorningWishesIntent")
def morning_wishes_intent_handler(handler_input):
try:
accessToken=handler_input.request_envelope.context.\
system.user.access_token
print(accessToken)
speech_text = random.choice(MORNING_WISHES)
handler_input.response_builder.speak(speech_text).\
set_should_end_session(False)
except Exception as e:
speech_text = RESPONSES['EXCEPTION_MSG']
handler_input.response_builder.speak(speech_text).\
set_should_end_session(False)
return handler_input.response_builder.response
And as per the above code, I get none in access token and I tried to test account linking with my Alexa developer console without publishing the skill!
Developer console doesn't support account linking cards so there is no way to test it there. You should test account linking using alexa app or going to the alexa amazon website. Just remember to login with your developer account which has access to the skill. You'll find your account linking card there with the link with which you should be able to test if it works properly. Also you can go find your skill, in the skills tab and then go to the setting of that skill and test account linking from there.
I am new to actions on google and I am trying to explore account linking feature.
I was able to create a project under google actions and link it to dialog flow. Enabled account linking and everything worked fine.
Now I created a second project and followed the same process. This time account linking card is not showing on my google home app.
When I tried to check the difference between two project what I found that the account linking messages are different.
For working action this is the message:
It looks like your <Project name> account is not linked yet. You can link <Project name> to your Google Account from the Google Home app.
For not working action, this is the message:
It looks like your my test app account is not linked yet.
It does not contain the second half of the message.
And also when I tried these actions on simulator, under DEBUG sharedDebugInfo-debugInfo the URL's are different.
For working action:
https://gala-demo.appspot.com/app?login_hint=google email id&service_id=projectid_dev&scope=openid&return_url=https://www.google.com/
For not working action:
https://assistant.google.com/services/auth/handoffs/auth/start?account_name=google email id&provider=projectid_dev&scopes=openid&return_url=https://www.google.com/
Can anyone help me understand why my second action is not working and why is it behaving different from the first one?
I tried inbuilt variable "user" methods, $user.name and $user.email in text response of API.AI, to greet user and show email-Id. Is there any inbuilt variable name user?
Example(User sign-up with Gmail),
Response-Code, I had tried in API.AI's text-response dialog box:
Hi, $user.firstname
This is your $user.email
Expected:
User: Hi!
My-Assistant-App: Hi, Varun.
User: Show my email-id
My-Assistant-App: This is your ******#gmail.com
Output, I am getting in the My-Assistant-App:
User: Hi!
My-Assistant-app: Hi, $user.firstname
User: Show my email-id
My-Assistant-App: This is your $user.email
There is no built in parameter user.
Even if there was such a built-in parameter, it wouldn't expose the email address automatically (and probably not the name, either).
Since you are using Actions on Google, you can use it to get user information such as the user's name, but this will require using Fulfillment through a webservice. See How to fetch device location using API AI? for more information about this (name and location are two things you can request permission for).
The email address, however, is not something you can request in this way. To do this, you'll probably have to go through account linking to link it to a Google identity. See How to authenticate user with just a Google account on Actions on Google? for further info as well.
There is no built-in variable 'user'. If you want such functionality, then you need to enable account linking. Use the access_token returned and use it to fetch name, email or anything.
I am able to make it work after a long time.
We have to enable the webhook first and we can see how to enable the webhook in the dialog flow fulfillment docs
If we are going to use Google Assistant, then we have to enable the Google Assistant Integration in the integrations first.
Then follow the steps mentioned below for the Account Linking in actions on google:-
Go to google cloud console -> APIsand Services -> Credentials -> OAuth 2.0 client IDs -> Web client -> Note the client ID, client secret from there
-> Download JSON - from json note down the project id, auth_uri, token_uri
-> Authorised Redirect URIs -> White list our app's URL -> in this URL fixed part is https://oauth-redirect.googleusercontent.com/r/ and append the project id in the URL
-> Save the changes
Actions on Google -> Account linking setup
1. Grant type = Authorisation code
2. Client info
1. Fill up client id,client secrtet, auth_uri, token_uri
2. Enter the auth uri as https://www.googleapis.com/auth and token_uri as https://www.googleapis.com/token
3. Save and run
4. It will show an error while running on the google assistant, but dont worry
5. Come back to the account linking section in the assistant settings and enter auth_uri as https://accounts.google.com/o/oauth2/auth
and token_uri as https://accounts.google.com/o/oauth2/token
6. Put the scopes as https://www.googleapis.com/auth/userinfo.profile and https://www.googleapis.com/auth/userinfo.email
and weare good to go.
7. Save the changes.
In the hosting server logs, we can see the access token value and through access token, we can get the details regarding the email address.
Append the access token to this link "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" and we can get the required details in the resulting json page.
accessToken = req.get("originalRequest").get("data").get("user").get("accessToken")
r = requests.get(link)
print("Email Id= " + r.json()["email"])
print("Name= " + r.json()["name"])
Since the original question was asked, there are now ways to get this information - with some caveats.
You can now use Google Sign In for Assistant to get profile information such as their Google ID and Name. If they have permitted their email address in the profile, this is included as well.
If you are using the actions-on-google library, this will be available in your Intent Handler in conv.user.profile.payload. If that isn't set, you can request it by using the Sign-In Helper to request it.
If you are using multivocal, you can set User/IsAuthenticated as a requirement and the information will be available in the environment under User/Profile.
In either case, the user will have to grant you permission to get the information the first time. After that, this information should be available for all subsequent requests.
I've built an Action using API.AI, and set it up with integration to Actions On Google. A webhook is used for fulfillment, together with account linking. I've followed the directions here to complete testing using my main google account that gives me access to the unpublished action in the web simulator and on my Google Home device that is set up with the same account.
Now it's time to deploy my Action. These instructions detail the process. One of the steps is to provide testing instructions for the Google reviewers that will approve the deployment. If you use account linking, it is necessary to provide them with test user credentials. Here is specifically what they request:
Provide any additional information needed to test your agent. If your agent requires account linking or login information, you must provide a username and password for a test account. Please make sure that any provided accounts are not real user accounts. This information will only be used by the review team, and will not be visible to users.
I've set up a test account for this purpose. I would obviously like to test my Action using the test account (instead of my main account) prior to submission for deployment. How do I do this?
If I use the web simulator and login with the test account, when I try and invoke the Action with my invocation name I get 'Sorry, this action is not available in simulation'.
When developing an Alexa Skill, Amazon provides for this as described here. While researching, I see references to similar provisions for Android developers with Google Play here. Where is the same thing for Actions On Google?
The test account is for the account linking step only.
To test your action in the simulator, you should be using the developer account you used to submit the action for review. The test account is used once your action is invoked and account linking is required to continue using your action.