go-pkgz / go-pkgz/auth

Telegram - support retrieving provider user ID

Open
#267 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.4k
Forks
97
Avg merge
2d 21h
Merged PRs (30d)
2

Description

My use case is the following - I'm allowing the use of Telegram as a login provider and don't collect any additional information, such as email. However, I still want to notify users about certain actions in their accounts. Looks like I cannot do this since the user ID is a hash. What's the proper way to support this? I don't mind creating a PR, but it needs some alignment on the design.

I was thinking about changing https://github.com/go-pkgz/auth/blob/master/v2/provider/telegram.go#L190-L194 to something like this:

const telegramUserIDAttr = "telegram_user_id"
....
user := &authtoken.User{
  ID:      id,
  Name:    update.Message.Chat.Name,
  Picture: avatarURL,
}
user.SetStrAttr(telegramUserIDAttr, fmt.Sprint(update.Message.Chat.ID))
authRequest.user = user

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading v2/provider/telegram.go around lines 190-194 and inspect how authtoken.User attributes are exposed. Align on whether the Telegram chat ID should be stored as a user attribute, then ensure the chosen design lets consumers retrieve it without changing the existing user ID behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.