Code Monkey home page Code Monkey logo

go-traktdeviceauth's Introduction

Go Trakt Device Auth Library

GoDoc GitHub release (latest by date) License GitHub go.mod Go version

A Go library to allow an end user to authorize a third-party Trakt application access to their account using the device method.

Conventions

Client ID and Client Secret

Throughout the library, the Client ID and Client Secret are used to tell Trakt which app is requesting access. These values are found in the dashboard for the app on Trakt's website, as shown in the image below.

Client ID and Client Secret on the Trakt Application Dashboard

Context Functions

Many functions in this library have context counterparts which allow a custom context.Context to be used. If you don't know what all this means, you'll probably be fine sticking with the non-context versions.

Installation

As a Go library: go get -u github.com/BrenekH/go-traktdeviceauth

As an executable: go install github.com/BrenekH/go-traktdeviceauth/cmd@latest or download from the latest release.

Usage

As suggested by the official API docs, a device and user code pair must be generated as the first step using GenerateNewCode. Next, the user needs to directed to the returned verification url and instructed to enter the user code into the website. Finally, PollForAuthToken is used to wait for the user to complete authentication or the code to expire.

If the returned access token expires, a new one can be generated with asking the user to re-authenticate by using RefreshAccessToken

Trakt recommends that the AccessToken and RefreshToken be saved in permanent storage so that the user doesn't need to log in every time your program starts.

License

This project is licensed under the Apache 2.0 license, a copy of which can be found in LICENSE.

go-traktdeviceauth's People

Contributors

brenekh avatar

Watchers

 avatar

go-traktdeviceauth's Issues

Setup a workflow to generate executables for every release

The README currently references the latest release as a place to download the CLI executable. However, no releases have been made which means that that link is currently broken.

The template for the Actions workflow would likely come from my other repositories such as Encodarr or Smart Reboot as these have CI/CD solutions that I'm fairly happy with.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.