skayocrafts / social-gitlab
GitLab integration for Social
Fund package maintenance!
Liberapay
buymeacoff.ee/Skayo
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Type:craft-plugin
Requires
- craftcms/cms: ^3.0.0-RC1
- dukt/social: ^2.0.0-beta.10
- omines/oauth2-gitlab: ^3.1
This package is auto-updated.
Last update: 2024-11-29 06:28:29 UTC
README
This plugin provides a GitLab integration for Social 2 for Craft CMS.
Requirements
This plugin requires Social 2.0.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require skayocrafts/social-gitlab
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for GitLab.
Setup
To enable the GitLab login provider, go to Social → Settings → Login Providers, and configure the “GitLab” login provider.
Self-Hosted GitLab Config
If you have a self-hosted GitLab and want to use it instead of gitlab.com for OAuth,
then you can set the domain in config/social.php
like this:
<?php return [ 'loginProviders' => [ // ... some other config ... 'gitlab' => [ // ... some other config ... 'oauth' => [ // ... some other config ... 'options' => [ // ... some other config ... 'domain' => 'https://gitlab.example.com' ] ], ] ] ];
For more information about the social configuration, look here
Some additional Information
Default User Field Mapping
The GitLab login provider defines the following user field mapping by default:
[
'id' => '{{ profile.getId() }}',
'email' => '{{ profile.getEmail() }}',
'username' => '{{ profile.getUsername() }}',
'photo' => '{{ profile.getAvatarUrl() }}',
]
You can override and extend the default mapping using the loginProviders config.
Profile Object
The profile response for the GitLab login provider is a GitlabResourceOwner object.
Methods
getId()
getName()
getUsername()
getEmail()
getAvatarUrl()
getProfileUrl()
getToken()
isActive()
isAdmin()
isExternal()
toArray()
getDomain()
setDomain()
getApiClient()
get()