{"id":13410027,"url":"https://github.com/iamelevich/pocketbase-plugin-telegram-auth","last_synced_at":"2026-02-22T14:46:13.213Z","repository":{"id":65732926,"uuid":"589679365","full_name":"iamelevich/pocketbase-plugin-telegram-auth","owner":"iamelevich","description":"This plugin implements Telegram WebApp Auth and Telegram Login Widget for the pocketbase","archived":false,"fork":false,"pushed_at":"2026-02-10T21:52:58.000Z","size":623,"stargazers_count":48,"open_issues_count":4,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-11T00:34:59.515Z","etag":null,"topics":["pocketbase","pocketbase-plugins","telegram","telegram-bot"],"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/iamelevich.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-16T17:21:35.000Z","updated_at":"2026-02-10T21:52:37.000Z","dependencies_parsed_at":"2024-04-03T18:28:39.825Z","dependency_job_id":"943bff38-1b51-4a9a-8e38-bd8817f29953","html_url":"https://github.com/iamelevich/pocketbase-plugin-telegram-auth","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/iamelevich/pocketbase-plugin-telegram-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamelevich%2Fpocketbase-plugin-telegram-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamelevich%2Fpocketbase-plugin-telegram-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamelevich%2Fpocketbase-plugin-telegram-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamelevich%2Fpocketbase-plugin-telegram-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamelevich","download_url":"https://codeload.github.com/iamelevich/pocketbase-plugin-telegram-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamelevich%2Fpocketbase-plugin-telegram-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29623546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T13:04:20.082Z","status":"ssl_error","status_checked_at":"2026-02-19T13:03:33.775Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["pocketbase","pocketbase-plugins","telegram","telegram-bot"],"created_at":"2024-07-30T20:01:04.572Z","updated_at":"2026-02-22T14:46:13.200Z","avatar_url":"https://github.com/iamelevich.png","language":"Go","funding_links":[],"categories":["Plugins","Tools/Plugin","Go","Go Plugins"],"sub_categories":["Extended Go"],"readme":"[![Test](https://github.com/iamelevich/pocketbase-plugin-telegram-auth/actions/workflows/test.yml/badge.svg)](https://github.com/iamelevich/pocketbase-plugin-telegram-auth/actions/workflows/test.yml)\n[![codecov](https://codecov.io/github/iamelevich/pocketbase-plugin-telegram-auth/graph/badge.svg?token=X91VFOND6D)](https://codecov.io/github/iamelevich/pocketbase-plugin-telegram-auth)\n\n\u003c!-- TOC --\u003e\n- [Overview](#overview)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n  - [Autofill fields](#autofill-fields)\n  - [Example](#example)\n    - [Usage](#usage)\n- [pocketbase\\_plugin\\_telegram\\_auth](#pocketbase_plugin_telegram_auth)\n  - [Index](#index)\n  - [type Options](#type-options)\n  - [type Plugin](#type-plugin)\n    - [func MustRegister](#func-mustregister)\n    - [func Register](#func-register)\n    - [func (\\*Plugin) AuthByTelegramData](#func-plugin-authbytelegramdata)\n    - [func (\\*Plugin) GetCollection](#func-plugin-getcollection)\n    - [func (\\*Plugin) GetForm](#func-plugin-getform)\n    - [func (\\*Plugin) Validate](#func-plugin-validate)\n- [Contributing](#contributing)\n  - [Process](#process)\n  - [Development setup](#development-setup)\n  - [Testing](#testing)\n    - [Writing tests](#writing-tests)\n  - [Linting](#linting)\n  - [Docs update in README](#docs-update-in-readme)\n\u003c!-- TOC --\u003e\n\n# Overview\n\nThis plugin implements [Telegram WebApp Auth](https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app) and [Telegram Login Widget](https://core.telegram.org/widgets/login) for the [pocketbase](https://github.com/pocketbase/pocketbase)\n\n## Requirements\n\n- Go 1.25+\n- [Pocketbase](https://github.com/pocketbase/pocketbase) 0.36+\n\n## Installation\n\n```bash\ngo get github.com/iamelevich/pocketbase-plugin-telegram-auth\n```\n\n## Autofill fields\n\nNext fields will be filled from telegram in auth collection record if exists:\n\n- `name` - string\n- `first_name` - string\n- `last_name` - string\n- `telegram_username` - string\n- `telegram_id` - string\n- `language_code` - string\n\n## Example\n\nYou can check examples in [examples folder](/examples)\n\n```go\npackage main\n\nimport (\n\ttgAuthPlugin \"github.com/iamelevich/pocketbase-plugin-telegram-auth\"\n\t\"log\"\n\n\t\"github.com/pocketbase/pocketbase\"\n)\n\nfunc main() {\n\tapp := pocketbase.New()\n\n\t// Setup tg auth for users collection\n\ttgAuthPlugin.MustRegister(app, \u0026tgAuthPlugin.Options{\n\t\tBotToken:      \"YOUR_SUPER_SECRET_BOT_TOKEN\", // Better to use ENV variable for that\n\t\tCollectionKey: \"users\",\n\t})\n\n\tif err := app.Start(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nAfter that new route `POST /api/collections/users/auth-with-telegram` will be available.\n\n### Usage\n\nSimple usage with js. You can check react example [here](./examples/webapp-react)\n```js\nconst pb = new PocketBase('http://127.0.0.1:8090');\npb.send('/api/collections/users/auth-with-telegram', {\n    method: 'POST',\n    body: {\n        data: window.Telegram.WebApp.initData\n    }\n}).then(res =\u003e {\n    pb.authStore.save(res.token, res.record);\n});\n```\n\n\u003c!-- gomarkdoc:embed:start --\u003e\n\n\u003c!-- Code generated by gomarkdoc. DO NOT EDIT --\u003e\n\n# pocketbase\\_plugin\\_telegram\\_auth\n\n```go\nimport \"github.com/iamelevich/pocketbase-plugin-telegram-auth\"\n```\n\n## Index\n\n- [type Options](\u003c#Options\u003e)\n- [type Plugin](\u003c#Plugin\u003e)\n  - [func MustRegister\\(app core.App, options \\*Options\\) \\*Plugin](\u003c#MustRegister\u003e)\n  - [func Register\\(app core.App, options \\*Options\\) \\(\\*Plugin, error\\)](\u003c#Register\u003e)\n  - [func \\(p \\*Plugin\\) AuthByTelegramData\\(tgData forms.TelegramData\\) \\(\\*core.Record, \\*auth.AuthUser, error\\)](\u003c#Plugin.AuthByTelegramData\u003e)\n  - [func \\(p \\*Plugin\\) GetCollection\\(\\) \\(\\*core.Collection, error\\)](\u003c#Plugin.GetCollection\u003e)\n  - [func \\(p \\*Plugin\\) GetForm\\(optAuthRecord \\*core.Record\\) \\(\\*forms.RecordTelegramLogin, error\\)](\u003c#Plugin.GetForm\u003e)\n  - [func \\(p \\*Plugin\\) Validate\\(\\) error](\u003c#Plugin.Validate\u003e)\n\n\n\u003ca name=\"Options\"\u003e\u003c/a\u003e\n## type [Options](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L27-L34\u003e)\n\nOptions defines optional struct to customize the default plugin behavior.\n\n```go\ntype Options struct {\n    // BotToken is a Telegram bot token.\n    // You can get it from @BotFather.\n    BotToken string\n\n    // CollectionKey is a collection key (name or id) for PocketBase auth collection.\n    CollectionKey string\n}\n```\n\n\u003ca name=\"Plugin\"\u003e\u003c/a\u003e\n## type [Plugin](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L36-L40\u003e)\n\n\n\n```go\ntype Plugin struct {\n    // contains filtered or unexported fields\n}\n```\n\n\u003ca name=\"MustRegister\"\u003e\u003c/a\u003e\n### func [MustRegister](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L99\u003e)\n\n```go\nfunc MustRegister(app core.App, options *Options) *Plugin\n```\n\nMustRegister is a helper function to register plugin and panic if error occurred.\n\n\u003ca name=\"Register\"\u003e\u003c/a\u003e\n### func [Register](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L108\u003e)\n\n```go\nfunc Register(app core.App, options *Options) (*Plugin, error)\n```\n\nRegister plugin in PocketBase app.\n\n\u003ca name=\"Plugin.AuthByTelegramData\"\u003e\u003c/a\u003e\n### func \\(\\*Plugin\\) [AuthByTelegramData](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L89\u003e)\n\n```go\nfunc (p *Plugin) AuthByTelegramData(tgData forms.TelegramData) (*core.Record, *auth.AuthUser, error)\n```\n\nAuthByTelegramData returns auth record and auth user by Telegram data.\n\n\u003ca name=\"Plugin.GetCollection\"\u003e\u003c/a\u003e\n### func \\(\\*Plugin\\) [GetCollection](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L60\u003e)\n\n```go\nfunc (p *Plugin) GetCollection() (*core.Collection, error)\n```\n\nGetCollection returns PocketBase collection object for collection with name or id from options.CollectionKey.\n\n\u003ca name=\"Plugin.GetForm\"\u003e\u003c/a\u003e\n### func \\(\\*Plugin\\) [GetForm](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L76\u003e)\n\n```go\nfunc (p *Plugin) GetForm(optAuthRecord *core.Record) (*forms.RecordTelegramLogin, error)\n```\n\nGetForm returns Telegram login form for collection with name or id from options.CollectionKey.\n\n\u003ca name=\"Plugin.Validate\"\u003e\u003c/a\u003e\n### func \\(\\*Plugin\\) [Validate](\u003chttps://github.com/iamelevich/pocketbase-plugin-telegram-auth/blob/master/plugin.go#L43\u003e)\n\n```go\nfunc (p *Plugin) Validate() error\n```\n\nValidate plugin options. Return error if some option is invalid.\n\nGenerated by [gomarkdoc](\u003chttps://github.com/princjef/gomarkdoc\u003e)\n\n\n\u003c!-- gomarkdoc:embed:end --\u003e\n\n# Contributing\n\nThis pocketbase plugin is free and open source project licensed under the [MIT License](LICENSE.md).\nYou are free to do whatever you want with it, even offering it as a paid service.\n\n## Process\n\n- Fork the repo\n- Create a new branch\n- Make your changes\n- Create a pull request\n- Wait for review\n- Make changes if needed\n- Merge\n- Celebrate :)\n\n## Development setup\n\n- Install [mise](https://mise.jdx.dev/installing-mise.html) and run `mise install`.\n- Setup `prek` hooks with `prek install -t commit-msg -t pre-commit`\n## Testing\n\n- Run `mise run test` to run tests\n- Run `mise run test-report` to run tests and get coverage report in `./coverage.html`\n\n### Writing tests\n\n- Check [PocketBase testing guide](https://pocketbase.io/docs/testing/) this will be used for API calls testing\n- To run test server and update testdata run `mise run run-test-server`\n  - Go to admin panel http://localhost:8090/_/\n  - Login: `test@test.test`\n  - Password: `testpassword`\n  - Folder with sqlite db: `./test/test_pb_data`\n\n## Linting\n\n- Run `mise run lint` to run linters\n\n## Docs update in README\n\n- Run `mise run docs` to update docs in README (it will also install [gomarkdoc](https://github.com/princjef/gomarkdoc))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamelevich%2Fpocketbase-plugin-telegram-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamelevich%2Fpocketbase-plugin-telegram-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamelevich%2Fpocketbase-plugin-telegram-auth/lists"}