opentidal
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.5 • Public • Published


    A thin TIDAL API wrapper written in TypeScript with 100% test coverage.

    Codecov

    Example usage

    import { auth } from "openTIDAL"
    
    const client_id = "client_id"
    const client_secret = "client_secret"
    
    ;(async () => {
      // get a device token to start the auth process
      const deviceToken = await auth.getDeviceToken({ client_id })
    
      // prints something like https://link.tidal.com/ABCDE
      // go to the provided URI and authorize the device
      console.log(`authorize via https://${deviceToken.verificationUriComplete}`)
    
      let accessToken
    
      // poll this endpoint until authorization is complete
      const interval = setInterval(async () => {
        console.log("checking if authorized")
        accessToken = await auth.getAccessToken({
          client_id,
          client_secret,
          device_code: deviceToken.deviceCode,
        })
    
        // if the response contains an access_token, you're authenticated!
        if ("access_token" in accessToken) {
          clearInterval(interval)
          console.log("access_token:", accessToken.access_token)
        }
      }, deviceToken.interval * 1000)
    })()

    Install

    npm i opentidal

    DownloadsWeekly Downloads

    23

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    39.2 kB

    Total Files

    17

    Last publish

    Collaborators

    • vaaski