Add H2H authentication service and new example flows

- Implement H2H authentication service for secure client authentication
- Add new examples for authorization code flow and H2H auth service
- Include example for generating client secret
- Update core connector and token request functionality
- Enhance README with new features

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-23 20:58:30 +03:00
parent 60c99bca40
commit 2964c391b5
11 changed files with 497 additions and 11 deletions

View File

@@ -16,10 +16,26 @@ $baas = AlfaBank::baas(
try {
echo "Authenticating...\n";
$baas->login(
// METHOD A: Standard Client Credentials (for simple services)
// $baas->login(
// clientId: 'your-client-id',
// clientSecret: 'your-client-secret'
// );
// METHOD B: Authorization Code Flow (H2H) (for Nominal Accounts)
// See examples/13_h2h_auth_service.php for the full setup
$auth = \Apoloz\AlfaBank\AlfaBank::auth(
clientId: 'your-client-id',
clientSecret: 'your-client-secret'
clientSecret: 'your-client-secret',
redirectUri: 'https://...',
certificatePath: __DIR__ . '/certs/client.cer',
privateKeyPath: __DIR__ . '/certs/private.key',
environment: Environment::SANDBOX
);
// Assuming you have a saved refresh token:
// $auth->refreshToken('saved_refresh_token');
echo "Authentication Successful!\n";
// 2. Create a Beneficiary (Counterparty)