エージェントコマース: クライアント登録完了画面にトークン取得例 (scope の指定方法) を追記する

Open Beginner friendly
#194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
php
Domain
documentation

Research direction

Start with templates/agent_commerce_client_issued.twig, the registration completion view named in the issue, and review the POST /token request details. Add a copyable curl example showing client_credentials, available client scopes, and the behavior when scope is omitted; the page should explain how the issued credentials are used to obtain a token.

Written by the indexing model from the issue text.

Description

documentation enhancement

背景

#191 のレビュー (#discussion_r3732470588) から切り出しました。

ACP/UCP クライアント (client_credentials) でトークンを取得する際、エージェント事業者から見て scope の指定方法が分かる導線がありません。現状の挙動は次のとおりです。

送信内容 結果
scope 省略 200 / クライアントが保有する scope がすべて付与される (ScopeRepository::setupScopes()empty($requestedScopes) 分岐でクライアント scope をそのまま返すため)
scope=acp:checkout のようにクライアント保有 scope を明示 200 / 明示した scope のみ付与
クライアントが保有しない scope を明示 (例: scope=read) invalid_scope

動作としては問題ありませんが、登録完了画面 (agent_commerce_client_issued.twig) にはクライアント ID とシークレットしか表示されないため、事業者へ渡す際に「このシークレットでどうトークンを取るのか」が伝わりません。

やりたいこと

登録完了画面に POST /token の要求例を追記する。

  • grant_type=client_credentials であること
  • scope に何を指定できるか (そのクライアントに付与した scope)
  • scope を省略した場合は付与済み scope が全付与されること

curl 例をそのまま貼れる形にしておくと、事業者への連携がそのまま行えて親切だと思います。

補足

scopes.default: ['read'] はトークン発行経路とは無関係で、AddClientDefaultScopesListener (クライアント保存時に scope 未指定なら既定を入れる) にのみ効きます。レビュー中に私が誤解した点なので、あわせて記録しておきます。

Dominant language
PHP
Stars
9
Forks
18
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EC-CUBE/eccube-api4

All issues in EC-CUBE/eccube-api4

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.