Timeline Event Unauthorized

oauth
timeline

#1

I have been fighting through the process of creating a timeline event in my developer portal. In doing so, I created an event type in the developer portal and then created a process to obtain an OAuth 2 token. In my request for the token, I included the following scopes, and obtained an access token: contact, automation and timeline.

In my application, I have set up a call to the api, here: https://api.hubapi.com/integrations/v1/:app_id/timeline/event"; where “:app_id” is my application id for my developer account. I sent a put request to the URL above, with header containing the access token, as described in the docs.

However, when I send the data to that URL, I receive the reponse: StatusCode: 401, ReasonPhrase: ‘Unauthorized’

There may be an error in my JSON payload, but then, I would think, I would get a different error back, but I don’t understand why I am getting “Unauthorized”.


#2

Hi @carltonsmith,

When you say you’re trying to create a timeline event in your developer portal, do you mean that you’re trying to create/edit an event type? Or are you trying to create an actual event on a contact’s timeline? If you’re trying to create an event on a contact timeline, you’ll need to install your app in a test portal and create the event using the OAuth token from that portal. Developer portals don’t have access to contacts, or any other of the normal tools, they just the developer tools (creating apps and test portals).


#3

This whole system makes no sense to me. I want the event in the contacts timeline so it can be accessed from our main marketing portal. I can create an event type in the developer portal and I can use the app id from the developer portal to request an OAuth to the main marketing portal, using the timeline scope and it allows this. But then when I send a request using the timeline scope it’s unauthorized because I need a test portal?


#4

Hi @carltonsmith,

I’m sorry, I don’t think I was clear in my last reply. You don’t need to have a test portal in addition to your main marketing portal. I wasn’t aware you were actively using a marketing portal; I misread your post, and thought you were trying to create events in your developer portal.

Can you reach back out with the full error response (including the body?) I’d like to take a closer look at the error body.


#5

Actually I am doing it in the developer portal, as my understanding is that is the only place I can do it. I can’t create event types in the main marketing portal. Is that wrong? I’m working on getting you the error now.


#6

Here is the error:

{StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:\r\n{\r\n Access-Control-Allow-Credentials: false\r\n Connection: close\r\n Date: Thu, 14 Sep 2017 18:44:09 GMT\r\n Content-Length: 929\r\n Content-Type: application/json; charset=UTF-8\r\n}}