{"id":15685560,"url":"https://github.com/grokify/go-pkce","last_synced_at":"2025-05-07T18:09:19.388Z","repository":{"id":57635572,"uuid":"426531485","full_name":"grokify/go-pkce","owner":"grokify","description":"Go library for OAuth 2.0 PKCE.","archived":false,"fork":false,"pushed_at":"2025-03-17T09:28:40.000Z","size":36,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T18:07:48.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grokify.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-10T07:52:22.000Z","updated_at":"2025-05-02T22:28:08.000Z","dependencies_parsed_at":"2024-06-20T19:06:15.689Z","dependency_job_id":"cc9c2b33-d28e-4f99-9dfb-48ac0d973285","html_url":"https://github.com/grokify/go-pkce","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grokify%2Fgo-pkce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grokify%2Fgo-pkce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grokify%2Fgo-pkce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grokify%2Fgo-pkce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grokify","download_url":"https://codeload.github.com/grokify/go-pkce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931535,"owners_count":21827111,"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":[],"created_at":"2024-10-03T17:26:44.167Z","updated_at":"2025-05-07T18:09:19.362Z","avatar_url":"https://github.com/grokify.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PKCE for Go\n\n[![CI Status][build-status-svg]][build-status-url]\n[![Lint Status][lint-status-svg]][lint-status-url]\n[![Go Report Card][goreport-svg]][goreport-url]\n[![Code Coverage][codecov-svg]][codecov-url]\n[![Docs][docs-godoc-svg]][docs-godoc-url]\n[![License][license-svg]][license-url]\n\n [build-status-svg]: https://github.com/grokify/go-pkce/actions/workflows/ci.yaml/badge.svg?branch=master\n [build-status-url]: https://github.com/grokify/go-pkce/actions/workflows/ci.yaml\n [lint-status-svg]: https://github.com/grokify/go-pkce/actions/workflows/lint.yaml/badge.svg?branch=master\n [lint-status-url]: https://github.com/grokify/go-pkce/actions/workflows/lint.yaml\n [goreport-svg]: https://goreportcard.com/badge/github.com/grokify/go-pkce\n [goreport-url]: https://goreportcard.com/report/github.com/grokify/go-pkce\n [codecov-svg]: https://codecov.io/gh/grokify/go-pkce/branch/master/graph/badge.svg\n [codecov-url]: https://codecov.io/gh/grokify/go-pkce\n [docs-godoc-svg]: https://pkg.go.dev/badge/github.com/grokify/go-pkce\n [docs-godoc-url]: https://pkg.go.dev/github.com/grokify/go-pkce\n [license-svg]: https://img.shields.io/badge/license-MIT-blue.svg\n [license-url]: https://github.com/grokify/go-pkce/blob/master/LICENSE\n\n`go-pkce` package contains an implementation for OAuth 2.0 PKCE spec, [IETF RFC 7636](https://datatracker.ietf.org/doc/html/rfc7636).\n\n## Installation\n\n```\ngo get github.com/grokify/go-pkce\n```\n\nOr you can manually git clone the repository to\n`$(go env GOPATH)/src/github.com/grokify/go-pkce`.\n\n## Usage\n\n```go\nimport(\"github.com/grokify/go-pkce\")\n\nfunc main() {\n  // Create a code_verifier with default 32 byte length.\n  codeVerifier := pkce.NewCodeVerifier(-1)\n\n  // Create a code_verifier with a custom length (32-96 bytes)\n  codeVerifier, err := pkce.NewCodeVerifierWithLength(96)\n\n  // Create a code_challenge using `S256`\n  codeChallenge := pkce.CodeChallengeS256(codeVerifier)\n}\n```\n\n## Usage with `oauth2`\n\n```go\nimport(\n  \"context\"\n\n  \"github.com/grokify/go-pkce\"\n  \"golang.org/x/oauth2\"\n)\n\nfunc main() {\n  // Create a code_verifier with default 32 byte length.\n  codeVerifier := pkce.NewCodeVerifier()\n\n  // Create a code_challenge using `S256`\n  codeChallenge := pkce.CodeChallengeS256(codeVerifier)\n\n  // Create authorization_code URL using `oauth2.Config`\n  authURL := oauth2Config.AuthCodeURL(\n    \"myState\",\n    oauth2.SetAuthURLParam(pkce.ParamCodeChallenge, codeChallenge),\n    oauth2.SetAuthURLParam(pkce.ParamCodeChallengeMethod, pkce.MethodS256))\n\n  // ... retrieve authorization_code ...\n\n  // Exchange the authorization_code for a token with PKCE.\n  token, err := oauth2Config.Exchange(\n    context.Background(),\n    \"myCode\",\n    oauth2.SetAuthURLParam(pkce.ParamCodeVerifier, codeVerifier),\n  )\n}\n```\n\n## Similar projects\n\n* [`github.com/nirasan/go-oauth-pkce-code-verifier`](https://github.com/nirasan/go-oauth-pkce-code-verifier)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrokify%2Fgo-pkce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrokify%2Fgo-pkce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrokify%2Fgo-pkce/lists"}