0

So I am creating a simple web application using the MEAN stack. I am trying to connect to asana through asana connect using the browser pop-up example. For a simple test I have code that is nearly identical to the example, but I still get the error shown as the title for this question.

I'm not sure what might be going wrong but here is the code.

The authentication is supposed to happen after a button click. The client id, client secret are taken from my account settings on the main website. The redirect uri is also set to http://localhost:3000, so I know for sure that they match.

$scope.signIn = function(){

    var client = Asana.Client.create({
        clientId: My client id,
        clientSecret: my client secret,
        redirectUri: 'http://localhost:3000'
    });

    client.useOauth(
        {
             flowType: Asana.auth.PopupFlow
        });

    client.authorize().then(function(){
        console.log("log-in success");
    }).catch(function(err){
        console.log(err);
    });

};

Peter Kim
  • 25
  • 3

1 Answers1

0

For the best user experience and for your application to work properly you want your redirect to accept the incoming HTTP request, parse out the access_token or code (depending on which grant flow) and subsequently render a page for the user.

You can read more about authentication mechanisms on the Asana platform in our documentation

Andrew Noonan
  • 848
  • 6
  • 13