Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ See the [authenticating](https://www.netlify.com/docs/api/#authenticating) docs

```js
// example:
const open = require('open') // installed with 'npm i open'

const login = async () => {
const ticket = await api.createTicket({
const ticket = await client.createTicket({
clientId: CLIENT_ID,
})
// Open browser for authentication
await openBrowser(`https://app.netlify.com/authorize?response_type=ticket&ticket=${ticket.id}`)
const accessToken = await api.getAccessToken(ticket)
await open(`https://app.netlify.com/authorize?response_type=ticket&ticket=${ticket.id}`)
const accessToken = await client.getAccessToken(ticket)
// API is also set up to use the returned access token as a side effect
return accessToken // Save this for later so you can quickly set up an authenticated client
}
Expand Down