0

I'm building an app utilizing the new Action on Google Java API. As I understand from dealing with account linking in Alexa, the initial flow (when the userId in the JSON request is null) should redirect to a sign in form to elicit user consent:

    @ForIntent("RawText")
    public ActionResponse launchRequestHandler(ActionRequest request) {

       String userId = request.getAppRequest().getUser().getUserId();
       String queryText = request.getWebhookRequest().getQueryResult().getQueryText();

       String speech = null;

            ResponseBuilder responseBuilder = getResponseBuilder(request);

            if (isBlank(userId) || GREETING.equalsIgnoreCase(queryText)) {

                speech = "I've sent a link to your Google Assistant app that will get you started and set up in just several simple steps.";

                responseBuilder.add(
                    new SignIn()
                        .setContext(speech));
                //...
                return responseBuilder.build();

While testing in the AoG Simulator, however, I'm not seeing any redirection being done. I'm seeing the following error:

enter image description here

My account linking setup:

enter image description here

where authorization URL redirects to a local mock auth service which is supposed to display a login form. It's accessible (both via localhost and via ssh tunnel, provided by serveo.net reverse proxy in this case). Why Google doesn't redirect me there?

Can someone please guide me how to do this initial handshake in the account linking flow and where can I see the form which the Sign-In intent sent from the web hook is supposed to trigger?

I'd rather not use my phone, as the error message seems to suggest, as the account under which I'm testing in AoG simulator differs from my user ID on the phone.

What is meant by using Simulator as a Speaker? What is missing in my setup?

Is there another Google app that simulates the physical device better, similar to Alexa's simulator?

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82

1 Answers1

1

Normally, you can simulate the account linking, by selecting the Debug tab, there you will find a url, copy-paste it on another tab and you can link your account. Once linking is done, go to the simulator and type 'cancel' or 'stop', and then 'Talk to speech bank'.

! Don't press reset or Change Version, or you have to re-link your app

But, recently Google has removed this url from debug tab, and I can't find it anywhere...

Simulator as a Speaker, The Surface Dropdown is set to Phone, you need to select Speaker,

but when you try that one, you will receive this error...

Invocation Error
You cannot use standard Google Assistant features in the Simulator. If you want to try them, use Google Assistant on your phone or other compatible devices. 

So for the moment, you can't test an Action that needs account linking, using the simulator. You can do it with your smartphone...

UPDATE 2019-03-05:

Google has added the account linking in the simulator, which is now easier to test. enter image description here

Aytacworld
  • 145
  • 2
  • 12
  • Yes, I tried `Simulator as a Speaker` approach and get the same error. How do I use it on the phone? When I say `talk to speechbank` there in assistant app, it gives some irrelevant results. Do I need to somehow publish the action or am I missing something else? – Simeon Leyzerzon Feb 20 '19 at 14:07
  • 1
    You have 2 options: 1) you don't publish your Action, but you need to use the same account on your phone. You can switch account in the Accounts settings on assistant app. 2) You release an alpha version of your Action and put your email(that you use on your phone) in the Alpha testers list. And wait one day, and you can test it on your device... In your alpga testers page, you need to copy the opt-in link and open it in your assistant enabled phone. And an Alpha deploy also takes one day to be deployed and testable on your phone(even if they say 3-4 hours). – Aytacworld Feb 21 '19 at 07:30
  • Thanks, with your suggestions, etc. we were able to figure out a set up that seems to work, however we are now faced with another challenge described here:https://stackoverflow.com/questions/54810597/malformedresponse-failed-to-parse-dialogflow-response-into-appresponse-because. Perhaps, you could give us some pointers helping to resolve that one out as well. – Simeon Leyzerzon Feb 21 '19 at 18:24
  • I have exactly the same problem... and can't resolve it. I've tried option 1. Don't know what to do as I don't want to publish yet (as it just a test). – Alexxx Feb 28 '19 at 19:20
  • On you phone, use the gmail account you are using to create the action. Then open your assistant app on your phone and search in the explore section to your action.(https://support.google.com/googlehome/answer/7126338?co=GENIE.Platform%3DAndroid&hl=en) even if you didn't released it yet, it will be available to your account only. – Aytacworld Mar 01 '19 at 21:25