Difference between revisions of "OAuth2Client"
Jump to navigation
Jump to search
BenKoo>Admin |
BenKoo>Benkoo |
||
Line 17: | Line 17: | ||
<syntaxhighlight lang=php> | <syntaxhighlight lang=php> | ||
wfLoadExtension( 'MW-OAuth2Client' ); | wfLoadExtension( 'MW-OAuth2Client' ); | ||
$wgOAuth2Client['client']['id'] = " | $wgOAuth2Client['client']['id'] = "alpha_numerical_strings_representing_client_id"; | ||
$wgOAuth2Client['client']['secret'] = " | $wgOAuth2Client['client']['secret'] = "alpha_numerical_strings_representing_secret"; | ||
$wgOAuth2Client['configuration']['authorize_endpoint'] = 'https://github.com/login/oauth/authorize'; // Authorization URL | $wgOAuth2Client['configuration']['authorize_endpoint'] = 'https://github.com/login/oauth/authorize'; // Authorization URL | ||
$wgOAuth2Client['configuration']['access_token_endpoint'] = 'https://github.com/login/oauth/access_token'; // Token URL | $wgOAuth2Client['configuration']['access_token_endpoint'] = 'https://github.com/login/oauth/access_token'; // Token URL | ||
Line 29: | Line 29: | ||
$wgOAuth2Client['configuration']['service_login_link_text'] = 'OAuth-Github'; // the text of the login link | $wgOAuth2Client['configuration']['service_login_link_text'] = 'OAuth-Github'; // the text of the login link | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=References= | =References= | ||
[[Category:Software Installation]] | [[Category:Software Installation]] |
Revision as of 04:23, 29 April 2021
OAuth stands for Open Authentication, and OAuth2, is an abbreviation for Open Auth 2.0.
This article tries to explain how to install OAuth2Client for MediaWiki.
Github as the OAuth Server
For the purpose of getting started, Github.com will be used as the OAuth Service provider. The first step is to create an OAuth Application on Github. One should already have an account on Github. The process of how to create an OAuth application for your Github account can be found here[1]:
Please go through the following process:
- Login to your Github.com account.
- Go to your settings, and navigate to create new OAuth Applications. The link[1] is shown.
- You will be prompted with an interface that gives your a new Client ID and ask you to name your application, upload a logo for the application, and you will use the interface to generate a Client Secret.
- Capture the Client ID and Secret.
- Make sure that you have MW-OAuth2Client package already installed in your MediaWiki's /extensions directory.
- Append the following the text to your LocalSettings.php
wfLoadExtension( 'MW-OAuth2Client' );
$wgOAuth2Client['client']['id'] = "alpha_numerical_strings_representing_client_id";
$wgOAuth2Client['client']['secret'] = "alpha_numerical_strings_representing_secret";
$wgOAuth2Client['configuration']['authorize_endpoint'] = 'https://github.com/login/oauth/authorize'; // Authorization URL
$wgOAuth2Client['configuration']['access_token_endpoint'] = 'https://github.com/login/oauth/access_token'; // Token URL
$wgOAuth2Client['configuration']['api_endpoint'] = 'https://api.github.com/user'; // URL to fetch user JSON
$wgOAuth2Client['configuration']['redirect_uri'] = "http://localhost:9352/index.php/Special:OAuth2Client/callback";
$wgOAuth2Client['configuration']['username'] = 'login'; // JSON path to username
$wgOAuth2Client['configuration']['email'] = 'email'; // JSON path to email
$wgOAuth2Client['configuration']['scopes'] = 'openid email profile'; //Permissions
$wgOAuth2Client['configuration']['service_name'] = 'Oauth Registry'; // the name of your service
$wgOAuth2Client['configuration']['service_login_link_text'] = 'OAuth-Github'; // the text of the login link