markocupic / contao-github-login
Contao GitHub Login
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:contao-bundle
Requires
- php: ^8.2
- contao/core-bundle: ^5.2
- league/oauth2-client: ^2.7
- league/oauth2-github: ^3.0
- markocupic/contao-oauth2-client: ^1.1
- markocupic/contao-twig-assets: ^1.1
Requires (Dev)
- contao/manager-plugin: ^2.12
README
Contao GitHub Login
This extension adds a GitHub login button to Contao, both in the frontend and in the backend. Before/after installation you have to register a GitHub App and save the client_id
and client_secret
in your .env file.
To activate or deactivate the application, the configuration file config.yaml must be edited under config/config.yaml
.
Frontend Module
To display the login button in the frontend, create a member login module and select the mod_login_github template.
Installation
composer require markocupic/contao-github-login
Configuration
# config/config.yaml markocupic_contao_oauth2_client: disable_contao_core_backend_login: false # Disable original Contao backend login enable_csrf_token_check: true markocupic_contao_github_login: contao_oauth2_clients: github_backend: enable_login: true client_id: '%env(CONTAO_GITHUB_LOGIN_CLIENT_ID)%' client_secret: '%env(CONTAO_GITHUB_LOGIN_CLIENT_SECRET)%' github_frontend: enable_login: true client_id: '%env(CONTAO_GITHUB_LOGIN_CLIENT_ID)%' client_secret: '%env(CONTAO_GITHUB_LOGIN_CLIENT_SECRET)%'
# .env
CONTAO_GITHUB_LOGIN_CLIENT_ID=6337hdhks7d62277sd
CONTAO_GITHUB_LOGIN_CLIENT_SECRET=738gdsksd893723723932023023932
Register GitHub App
- Log in to your GitHub Account and go to GitHub Developer Settings to enter the callback URLS and get your GitHub client_id and client_secret.
- Register a new GitHub App.
- Add a name for your GitHub app.
- Add the homepage URL:
https://my-page.ch
- Add the first callback URL:
https://my-page.ch/_oauth2_login/github_backend/backend
for the Backend Login. - Add the second callback URL:
https://my-page.ch/_oauth2_login/github_frontend/frontend
for the Frontend Login. - Save your settings.
- Generate the client secret
- In a next step write the client_id and the client_secret to your .env file.
- Click Permissions & events in the navigation on the left.
- Open Account permissions and select Read-only access under Email addresses