diff --git a/apps/block_scout_web/config/config.exs b/apps/block_scout_web/config/config.exs index e0daba023f..19182c508d 100644 --- a/apps/block_scout_web/config/config.exs +++ b/apps/block_scout_web/config/config.exs @@ -13,7 +13,7 @@ config :block_scout_web, # 604800 seconds, 1 week session_cookie_ttl: 60 * 60 * 24 * 7, invalid_session_key: "invalid_session", - api_v2_temp_token_key: "api_v2_temp_client_key" + api_v2_temp_token_key: "api_v2_temp_token" config :block_scout_web, admin_panel_enabled: System.get_env("ADMIN_PANEL_ENABLED", "") == "true" diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex index 255b138723..4135a6bba9 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex @@ -9,6 +9,10 @@ defmodule BlockScoutWeb.API.V2.APIKeyController do plug(:fetch_cookies, signed: [@api_v2_temp_token_key]) + @doc """ + Function to handle POST requests to `/api/v2/key` endpoint. It expects body with `recaptcha_response`. And puts cookie with temporary API v2 token. Which is handled here: https://github.com/blockscout/blockscout/blob/cd19739347f267d8a6ad81bbba2dbdad08bcc134/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex#L170 + """ + @spec get_key(Plug.Conn.t(), nil | map) :: {:recaptcha, any} | Plug.Conn.t() def get_key(conn, params) do helper = Application.get_env(:block_scout_web, :captcha_helper) ttl = Application.get_env(:block_scout_web, :api_rate_limit)[:api_v2_token_ttl_seconds]