Difference between revisions of "OAuth2Client"
Jump to navigation
Jump to search
BenKoo>Admin |
BenKoo>Admin |
||
Line 4: | Line 4: | ||
==Github as the OAuth Server== | ==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<ref>https://github.com/settings/applications/new</ref>: | 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<ref name=NewOAuthApp>https://github.com/settings/applications/new</ref>: | ||
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<ref name=NewOAuthApp></ref> 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 | |||
<syntaxhighlight language=PHP> | |||
wfLoadExtension( 'MW-OAuth2Client' ); | |||
$wgOAuth2Client['client']['id'] = "ALPHA NUMERICAL STRING REPRESENTING CLIENT ID"; | |||
$wgOAuth2Client['client']['secret'] = "ALPHA NUMERICAL STRING REPRESENTING CLIENT 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 | |||
</syntaxhighlight> | |||
Revision as of 03:47, 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 STRING REPRESENTING CLIENT ID";
$wgOAuth2Client['client']['secret'] = "ALPHA NUMERICAL STRING REPRESENTING CLIENT 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
==