oauth-2.0actions-on-googlealexa-skills-kitaccount-linking

Account Linking redirect in Actions on Google simulator


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?


Solution

  • 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