Oauth/tickets create ticket API endpoint returns a ticket with Authorized: null

I’m sending a POST request to https://api.netlify.com/api/v1/oauth/tickets?client_id={clientId}, but I’m getting data like the following:

{
"id": "{ticketId}",
"client_id": "{clientId}",
"created_at": "2020-02-13T22:33:26.338Z",
"authorized": null

}

I don’t understand why the ticket is coming back as not authorized. It looks like this is preventing me from completing subsequent request to get the access token. What could be causing this

Can you tell us more about what you are trying to accomplish, @hanoitower ? Perhaps there’s a different workflow you could be using, or maybe this is a bug, but best to start from something like “I’m trying to programatically create access tokens so I can XXX with Netlify’s service” (but expand “XXX” as much as possible, please!) so we can give you the best advice.

The documentation here is not clear. After creating the Ticket, I had to go to Netlify App with my ticket, and authorize through the UI before I could my ticket to create the access token.

The way I found this out is by looking at the GitHub - netlify/js-client: A Open-API derived JS + Node.js API client for Netlify Readme. This flow needs to be clearly documented - the open api documentation didn’t have any details about this additional step.

It’s also unclear how to use Personal Access Tokens though you can generate them through the UI.

Yea, as mentioned in this post: [Support Guide] Understanding and using Netlify's API, the best way to learn how to use our API is to watch how our UI (app.netlify.com) does things. That said, I’m glad you found the info you needed in the js-client readme.

For those Personal Access Token, you can set those in an ‘Authorization’ header when invoking our API endpoints. The value will look like: Authorization: bearer <personal access token>

Hope that helps.

I also am receiving a response that has authorized: null

I’m trying to build an internal application that can create a new site and deploy it.
Should I be using a personal access token or an Oauth application?

Best,
Aaron

If you expect other people will be using your app, perhaps registering an OAuth application to your account makes more sense. You can read more about that here: Use OAuth provider tokens on your site | Netlify Docs.

1 Like