Power Automate HTTP Authentication

Hi Guys! So happy that I am here after a frustrating day of trying to pass the Authentication while creating an HTTP POST Method via Microsoft PowerAutomate.

What do I want to do?
I just want to move a task from one section into another one. So I used the POST https://app.asana.com/api/1.0/sections/1201520094677790/addTask URI.

I have created an access Token, Client ID as well as the Client Secret but now I am standing here and don´t even know where to put which data to authenticate in a proper way.

I do not even know if it was necessary to have all these token, id and secret… ^^

Available Options to authenticate via Power Automate HTTP are:

  • Basic
  • Client Certificate
  • Active Directory OAuth
  • Raw
  • Enter custom value

Ive attached all the Options and their Input fields into this topic





image

I hope someone can tell me where to put what and also where I can find these Information!

:slight_smile: Thanks a lot upfront!

When I do request using Postman, for example, authentication goes into the “Header” field.

It gives me the error

{“errors”:[{“message”:“Unrecognized request field gid. The only allowed keys at the top level are: data, options. Is it possible you did not wrap object properties in a data object?”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Errors”}]}

Ive attached the screenshots with the raw input as well as raw output

Result:

Raw Input:

{
    "uri": "https://app.asana.com/api/1.0/sections/1203263361450285/addTask",
    "method": "POST",
    "headers": {
        "Authorization": "*sanitized*"
    },
    "body": {
        "gid": "1203263361450285",
        "projects": [
            {
                "gid": "1201520094677789",
                "resource_type": "project",
                "name": "IT-Service, SIA"
            }
        ],
        "resource_type": "task",
        "created_at": "2022-10-29T08:13:25.173Z",
        "modified_at": "2022-10-29T08:13:26.112Z",
        "name": "Testtask",
        "notes": "",
        "completed": false,
        "assignee_status": "inbox",
        "resource_subtype": "default_task",
        "tags": [],
        "workspace": {
            "gid": "436595191387853",
            "resource_type": "workspace",
            "name": "IT-Service, SIA"
        },
        "num_hearts": 0,
        "num_likes": 0,
        "permalink_url": "https://app.asana.com/0/1201520094677789/1203263361450285",
        "memberships": [
            {
                "project": {
                    "gid": "1201520094677789",
                    "resource_type": "project",
                    "name": "IT-Service, SIA"
                },
                "section": {
                    "gid": "1203244632305855",
                    "resource_type": "section",
                    "name": "Incomplete"
                }
            }
        ],
        "assignee": {
            "gid": "1202907352269887",
            "resource_type": "user",
            "name": "Recep Gencaslan"
        },
        "hearted": false,
        "hearts": [],
        "liked": false,
        "likes": [],
        "followers": [
            {
                "gid": "1202907352269887",
                "resource_type": "user",
                "name": "Recep Gencaslan"
            }
        ],
        "assignee_section": {
            "gid": "1202907369887610",
            "resource_type": "section",
            "name": "Recently assigned"
        },
        "custom_fields": [
            {
                "gid": "1201548785347846",
                "resource_type": "custom_field",
                "created_by": null,
                "resource_subtype": "enum",
                "type": "enum",
                "name": "Priority",
                "enabled": true,
                "enum_value": null,
                "display_value": null,
                "enum_options": [
                    {
                        "gid": "1201548785347847",
                        "resource_type": "enum_option",
                        "enabled": true,
                        "name": "High",
                        "color": "red"
                    },
                    {
                        "gid": "1201548785347848",
                        "resource_type": "enum_option",
                        "enabled": true,
                        "name": "Medium",
                        "color": "orange"
                    },
                    {
                        "gid": "1201548785347849",
                        "resource_type": "enum_option",
                        "enabled": true,
                        "name": "Low",
                        "color": "yellow-orange"
                    }
                ]
            }
        ]
    }
}

Raw Output:

{
    "statusCode": 400,
    "headers": {
        "Connection": "keep-alive",
        "pragma": "no-cache",
        "X-Frame-Options": "DENY",
        "X-XSS-Protection": "1; mode=block",
        "X-Content-Type-Options": "nosniff",
        "Content-Security-Policy": "report-uri https://app.asana.com/-/csp_report?report_only=false;default-src 'none';frame-src 'none';frame-ancestors 'none'",
        "X-Asana-Api-Version": "1.0",
        "Asana-Change": "name=new_user_task_lists;info=https://forum.asana.com/t/update-on-our-planned-api-changes-to-user-task-lists-a-k-a-my-tasks/103828,name=external_goal_metrics;info=https://forum.asana.com/t/changes-to-goal-metrics-progress-sources/221257,name=new_project_templates;info=https://forum.asana.com/t/a-new-api-for-project-templates/156432",
        "X-Robots-Tag": "none",
        "Cache-Control": "no-store",
        "Date": "Sat, 29 Oct 2022 08:13:27 GMT",
        "Set-Cookie": "TooBusyRedirectCount=0",
        "Server": "nginx",
        "Content-Length": "329",
        "Content-Type": "application/json; charset=UTF-8"
    },
    "body": {
        "errors": [
            {
                "message": "Unrecognized request field `gid`. The only allowed keys at the top level are: data, options. Is it possible you did not wrap object properties in a `data` object?",
                "help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
            }
        ]
    }
}

Here is also the Flow how I set it up:

You should try to do a working request in Postman first, just to get the syntax right.