Class: SpreeCmCommissioner::Telegram::CheckIdToken

Inherits:
Object
  • Object
show all
Includes:
Spree::ServiceModule::Base
Defined in:
app/services/spree_cm_commissioner/telegram/check_id_token.rb

Overview

Verifies a Telegram OIDC id_token and resolves the Spree::User already linked to that Telegram identity. Mirrors UserIdTokenChecker (the Firebase equivalent used by the dashboard's "Login with Google" button): unlike the storefront/mobile UserTelegramOauthAuthenticator, this never registers a new user - dashboard access requires an existing staff account that has already linked its Telegram identity.

Instance Method Summary collapse

Instance Method Details

#call(id_token:, client_id:, tenant_id: nil) ⇒ Object



12
13
14
15
16
17
# File 'app/services/spree_cm_commissioner/telegram/check_id_token.rb', line 12

def call(id_token:, client_id:, tenant_id: nil)
  provider_result = VerifyOauthIdToken.call(id_token: id_token, client_id: client_id)
  return provider_result unless provider_result.success?

  find_user(provider_result.value[:provider], tenant_id)
end