OAuth fails with "err::ERR_CONNECTION_REFUSED"

Hi all,

I am quite the novice with these smart-watch applications but I ran into an issue I have trouble solving myself.

I am trying to use the Garmin "makeOAuthRequest" mechanism and have lots of troubles here. First of all, I tried the Authentication.makeOAuthRequest approach but I cant the login page to appear at all. I tried lots of different parameters and configurations but the Login prompt does simply not appear (Connect IQ app running and everything).

Since that doesn't work, I am tinkering with the Communications.makeOAuthRequest and here I have the login prompt. My issue however is that I put in the defined redirect URI "
http://localhost" and after the successful login I can see an "err::ERR_CONNECTION_REFUSED" appearing on screen with the info that something went wrong. What is interesting is that I can actually see the full HTML response call and a valid code inside that could be used to fetch a token.

How can I solve this issue?

  1. What is causing my Authentication.makeOAuthRequest to fail?
  2. What is causing the "err::ERR_CONNECTION_REFUSED" after a successful login using Communications.makeOAuthRequest?

I hope somebody can shed some light into this confusion, many thanks in advance!

  • For context: I am trying to use the Microsoft Graph API and am using this example code from the docs:

            // set the makeOAuthRequest parameters
            var params = {

                "redirect_uri" => "connectiq://oauth",
                "response_type" => "code",
                "client_id" => $.CLIENT_ID
            };


            // makeOAuthRequest triggers login prompt on mobile device.
            // "responseCode" and "responseError" are the parameters passed
            // to the resultUrl. Check the oauth provider's documentation
            // to determine the correct strings to use.
            Authentication/Communications.makeOAuthRequest(
                "https://requesturl.com",
                params,
                "http://resulturl.com",
                Authentication/Communications.OAUTH_RESULT_TYPE_URL,
                {"responseCode" => OAUTH_CODE, "responseError" => OAUTH_ERROR}
            );

    Filled like that:
            var params_authorize = {
                "redirect_uri" => "connectiq://oauth"/"">http://localhost",
                "response_type" => "code",
                "client_id" => CLIENT_ID,
                "scope" => {MyMicrosoftApplicationScope},
            };


            Authentication/Communications.makeOAuthRequest(
                params_authorize,
                Authentication/Communications.OAUTH_RESULT_TYPE_URL,
                {"code" => OAUTH_CODE, "state" => OAUTH_STATE, "session_state" => OAUTH_SESSION_STATE}
            );

    I might be using some of these functions incorrectly but thats how I understood they are to be used.