Putting timeline event with valid token gives 401


#1

Hi,

I’m suspecting it’s something to do with encoding the access token, but honestly I have no clue. I’ve done all I can to QA this request to create a timeline event, but all I get is a sad 401.

I’ve got a token that is confirmed from the API as such:

{
    "token": "xxxxxxxxxxxxxxxx",
    "user": "lea@markedspartner.no",
    "hub_domain": "omnicom-test-dev-2610238.com",
    "scopes": [
        "contacts",
        "timeline",
        "oauth"
    ],
    "hub_id": 2610238,
    "app_id": 37129,
    "expires_in": 20786,
    "user_id": 739639,
    "token_type": "access"
}

I PUT a timeline event to the API as such:

PUT https://api.hubapi.com/integrations/v1/37129/timeline/event?access_token=xxxxxxxxxxxxxxxxx

Charset: UTF-8, Content-Type: application/json

{
    "id": "15a44168020e4996b6ca7c69ed08feb4",
    "eventTypeId": "15602",
    "email": "lea@markedspartner.no",
    "extraData": {
        "firstname": "Lars-Erik",
        "value": "500"
    }
}

And no matter what I do, I only get this

{
    "Version": {
        "Major": 1,
        "Minor": 1,
        "Build": -1,
        "Revision": -1,
        "MajorRevision": -1,
        "MinorRevision": -1
    },
    "Content": {
        "Headers": [
            {
                "Key": "Content-Length",
                "Value": [
                    "235"
                ]
            },
            {
                "Key": "Content-Type",
                "Value": [
                    "application/json; charset=UTF-8"
                ]
            }
        ]
    },
    "StatusCode": 401,
    "ReasonPhrase": "Unauthorized",
    "Headers": [
        {
            "Key": "Access-Control-Allow-Credentials",
            "Value": [
                "false"
            ]
        },
        {
            "Key": "Connection",
            "Value": [
                "close"
            ]
        },
        {
            "Key": "Date",
            "Value": [
                "Thu, 27 Oct 2016 08:22:23 GMT"
            ]
        }
    ],
    "RequestMessage": {
        "Version": {
            "Major": 1,
            "Minor": 1,
            "Build": -1,
            "Revision": -1,
            "MajorRevision": -1,
            "MinorRevision": -1
        },
        "Content": {
            "Headers": [
                {
                    "Key": "Content-Type",
                    "Value": [
                        "application/json; charset=utf-8"
                    ]
                },
                {
                    "Key": "Content-Length",
                    "Value": [
                        "147"
                    ]
                }
            ]
        },
        "Method": {
            "Method": "PUT"
        },
        "RequestUri": "https://api.hubapi.com/integrations/v1/37129/timeline/event?access_token=xxxxxxxxxxxxxxxxxxxxxxxx",
        "Headers": [],
        "Properties": {}
    },
    "IsSuccessStatusCode": false
}

Hints appreciated.


#2

Hi @Lars-Erik

If you’re using OAuth2, the access_token gets passed in an Authorization header, not in the URL.


#3

Thanks.

I guess it was naive of me, but I was just tagging along with the information here:

May I suggest updating it to using OAuth 2 since 1 is deprecated?

This page could also do with a ref. to v2:

(And I’m sure there’s more)

I actually didn’t read that page you’re linking to since none of the docs. about general app authentication with OAuth 2 mentions it, none of the timeline pages mention it etc.
Then again, I should probably know OAuth better, but I’m spoiled using API keys and don’t use OAuth that often.