mathieu-dumoutier / oauth2-orcid
为 PHP League OAuth2-Client 提供的 ORCID OAuth 2.0 客户端提供者
dev-main
2022-09-27 12:19 UTC
Requires
- php: >=8.0
- league/oauth2-client: ^2.0
Requires (Dev)
- phpunit/phpunit: 8.* || 9.*
This package is not auto-updated.
Last update: 2024-09-17 21:59:16 UTC
README
此软件包为 PHP League 的 OAuth 2.0 客户端 提供ORCID OAuth 2.0 支持。
安装
要安装,请使用 composer
composer require mathieu-dumoutier/oauth2-orcid
用法
用法与 The League 的 OAuth 客户端相同,使用 \MathieuDumoutier\OAuth2\Client\Provider\Orcid 作为提供者。
knpuniversity/oauth2-client-bundle 配置示例
knpu_oauth2_client: clients: orcid_oauth: type: generic provider_class: MathieuDumoutier\OAuth2\Client\Provider\Orcid provider_options: "scopes": '%env(ORCID_OAUTH_SCOPES)%' "use_member_api": '%env(ORCID_OAUTH_SANDBOX_MODE)%' "sandbox_mode": '%env(ORCID_OAUTH_MEMBER_API)%' "api_version": '%env(ORCID_OAUTH_API_VERSION)%' client_id: '%env(ORCID_APP_ID)%' client_secret: '%env(ORCID_APP_SECRET)%' redirect_route: orcid_check redirect_params: {} use_state: false
您必须定义6个环境变量
- ORCID_APP_ID
- ORCID_APP_SECRET
- ORCID_OAUTH_SCOPES (见 https://info.orcid.org/documentation/integration-guide/getting-started-with-your-orcid-integration/#easy-faq-2569)
- ORCID_OAUTH_SANDBOX_MODE (0或1)
- ORCID_OAUTH_MEMBER_API (0或1)
- ORCID_OAUTH_API_VERSION (v2.0, v2.1或v3.0)
您必须创建路由 "orcid_check"。
测试
$ ./vendor/bin/phpunit