Class: Spree::Api::V2::Storefront::TelegramOauthTokensController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/storefront/telegram_oauth_tokens_controller.rb

Overview

Server-side relay for the Telegram OAuth PKCE code -> id_token exchange. The mobile/web clients cannot hit Telegram's /token endpoint directly, so they POST the PKCE parameters here and we forward them to Telegram, returning its response verbatim. Public endpoint: the caller has no access token yet (this is part of logging in).

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
# File 'app/controllers/spree/api/v2/storefront/telegram_oauth_tokens_controller.rb', line 11

def create
  result = SpreeCmCommissioner::TelegramOauthTokenExchanger.call(exchange_params.to_h.symbolize_keys)

  return render_error_payload(result.message) unless result.success?

  render json: result.body, status: result.status, content_type: 'application/json'
end