webnode / oauth2-client
1.3.1
2024-09-26 09:58 UTC
Requires
- php: ~8.3.0
- guzzlehttp/guzzle: ^7.8.1
- lcobucci/jwt: ~5.3.0
Requires (Dev)
- phpmd/phpmd: ^2.10
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^10.3
- squizlabs/php_codesniffer: ^3.6
Suggests
- ext-http: *
- ext-json: *
This package is auto-updated.
Last update: 2025-05-18 10:43:16 UTC
README
Client for webnode auth/OAuth2
This can be used as SDK by partners, co no webnode library should be used.
Usage example
Instantiate factory
$factory = new \webnode\oauth2\Factory\WebnodeOAuth2Factory(
new \webnode\oauth2\Configuration(
'myClientId',
'myClientSecret',
'https://oauth2.webnode.com'
)
);
Generate Single Sign On Url
// generate SSO Link
$oauthApiService = $factory->createApi();
$ssoUrl = $oauthApiService->getAuthorizationUrlForUser(
$userIdentifier,// obtained from gateway-api with project info or registration
$redirectUrl // CMS or Administration (portal) URL, both can be obtained with same request as userIdentifier
);
// now just redirect to $ssoUrl
Generate Single Sign Out Url
// generate SSO Link
$urlGenerator = $factory->createUrlGenerator();
$ssOutUrl = $urlGenerator->getSSOutUrl(); // this url is universal, since it just disables access to current session
// now just redirect to $ssOutUrl
Logout user from all sessions
This can be used when changing password, disabling users access for violation and so on.
// generate SSO Link
$oauthApiService = $factory->createApi();
$urlGenerator->revokeUserAccess($userIdentifier);
// now just redirect to $ssOutUrl