{"id":23501547,"url":"https://github.com/brenekh/go-plexauth","last_synced_at":"2025-04-28T10:58:25.763Z","repository":{"id":57647247,"uuid":"442934314","full_name":"BrenekH/go-plexauth","owner":"BrenekH","description":"A Go utility to quickly authenticate a third party application with a Plex account.","archived":false,"fork":false,"pushed_at":"2022-01-07T06:23:40.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-25T07:18:25.455Z","etag":null,"topics":["authentication","command-line","go","golang","golang-library","plex","plex-media-server","plexmediaserver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrenekH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-30T01:31:10.000Z","updated_at":"2023-10-14T05:22:32.000Z","dependencies_parsed_at":"2022-09-07T20:22:54.025Z","dependency_job_id":null,"html_url":"https://github.com/BrenekH/go-plexauth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrenekH%2Fgo-plexauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrenekH%2Fgo-plexauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrenekH%2Fgo-plexauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrenekH%2Fgo-plexauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrenekH","download_url":"https://codeload.github.com/BrenekH/go-plexauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239156987,"owners_count":19591234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","command-line","go","golang","golang-library","plex","plex-media-server","plexmediaserver"],"created_at":"2024-12-25T07:18:27.531Z","updated_at":"2025-02-16T16:30:07.456Z","avatar_url":"https://github.com/BrenekH.png","language":"Go","readme":"# Plex Authentication (in Go!)\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/BrenekH/go-plexauth)](https://pkg.go.dev/github.com/BrenekH/go-plexauth)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/BrenekH/go-plexauth?label=version)\n[![License](https://img.shields.io/github/license/BrenekH/go-plexauth)](https://github.com/BrenekH/go-plexauth/tree/master/LICENSE)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/BrenekH/go-plexauth)\n\nThis tool is based on the instructions available in [this Plex forum post](https://forums.plex.tv/t/authenticating-with-plex/609370), which you should look over to understand the authentication flow.\nTo reiterate the high level steps, a PIN must be generated and formed into a URL that the user can visit which allows them to claim the PIN.\nAfter the PIN has been claimed, the Plex API will return an authentication token which can be used to access the Plex API on the user's behalf.\n\nGo PlexAuth automates this process making it easy to obtain a permanent auth token for API calls.\n\n## Installation\n\nAs a Go library: `go get github.com/BrenekH/go-plexauth`\n\nAs a CLI: `go install github.com/BrenekH/go-plexauth/cli@latest`\n\n## Usage\n\n### CLI\n\nRun the executable and enter a device name.\nYou will then need to visit the URL it prints out to the console to complete the authentication.\nOnce authentication is complete, your authentication token will be printed to the console.\n\n### Go Library\n\nBasic example:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/BrenekH/go-plexauth\"\n)\n\nfunc main() {\n    clientID := \"my-random-client-id\"\n\n    // Request that Plex generate a new PIN for a user to claim.\n    pinID, pinCode, err := plexauth.GetPlexPIN(appName, clientID)\n    if err != nil {\n        panic(err)\n    }\n\n    // Create the URL that the user needs to visit to claim the PIN.\n    authUrl, err := plexauth.GenerateAuthURL(appName, clientID, pinCode, plexauth.ExtraAuthURLOptions{})\n    if err != nil {\n        panic(err)\n    }\n\n    // Inform the user of the URL they need to visit. Typically this would\n    // automatically open the browser, but here it is printed to the console for simplicity's sake.\n    fmt.Printf(\"Please visit %s to authenticate.\\n\", authUrl)\n\n    // Repeatedly ask Plex if the PIN has been claimed yet. Times out after 30 minutes.\n    authToken, err := plexauth.PollForAuthToken(context.Background(), pinID, pinCode, clientID)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Printf(\"Your authentication token is \\\"%s\\\"\\n\", authToken)\n}\n```\n\nFor the full documentation, visit [pkg.go.dev/github.com/BrenekH/go-plexauth](https://pkg.go.dev/github.com/BrenekH/go-plexauth).\n\n## License\n\nThis project is licensed under the Apache 2.0 License, a copy of which can be found in [LICENSE](https://github.com/BrenekH/go-plexauth/tree/master/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenekh%2Fgo-plexauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrenekh%2Fgo-plexauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenekh%2Fgo-plexauth/lists"}