Class: SpreeCmCommissioner::UserTelegramOauthAuthenticator

Inherits:
BaseInteractor
  • Object
show all
Defined in:
app/interactors/spree_cm_commissioner/user_telegram_oauth_authenticator.rb

Overview

Authenticates a user from a verified Telegram OIDC id_token. Resolves an existing user by their telegram identity (sub) or registers a new one. Mirrors the inline identity handling of UserTelegramWebAppAuthenticator so that both Telegram login flows resolve to the same UserIdentityProvider.

Instance Method Summary collapse

Instance Method Details

#callObject

:id_token, :tenant_id (optional)



10
11
12
13
14
15
16
17
# File 'app/interactors/spree_cm_commissioner/user_telegram_oauth_authenticator.rb', line 10

def call
  context.fail!(message: 'telegram_id_token_missing') if id_token.blank?

  provider = verified_provider
  context.user = find_or_register_user(provider)

  context.fail!(message: 'account_temporarily_deleted') if context.user.soft_deleted?
end