Skip to content

Telegram - support retrieving provider user ID #267

Description

@MrZoidberg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions