![mediawiki oauth mediawiki oauth](http://jhamrick.github.io/2015-07-17-jupyterday/images/architecture1.png)
![mediawiki oauth mediawiki oauth](https://www.postyou.de/assets/images/7/nextcloud-single-sign-on-b0a4dcec.jpg)
The number of seconds of leeway to account for when examining aĪ dictionary containing identity information.įrom flask import Flask import mwoauth import mwoauth.flask app = Flask ( _name_ ) ( "/" ) def index (): return "Hello world" flask_mwoauth = mwoauth. access_token : AccessTokenĪ token representing an authorized user. Parameters:Ī token representing you, the consumer. Gather identifying information about a user via an authorized token. identify ( mw_uri, consumer_token, access_token, leeway=10.0, user_agent='python-mwoauth default user agent' ) ¶ The query string of the URL that MediaWiki forwards the user backĪn AccessToken containing an authorized key/secret pair that request_token : RequestTokenĪ temporary token representing the user. complete ( mw_uri, consumer_token, request_token, response_qs, user_agent='python-mwoauth default user agent' ) ¶Ĭomplete an OAuth handshake with MediaWiki by exchanging an Parameters:Ī key/secret pair representing you, the consumer. a RequestToken representing a request for access.consumer_token : ConsumerTokenĪ token representing you, the consumer. The base URI of the MediaWiki installation. Initiate an oauth handshake with MediaWiki. initiate ( mw_uri, consumer_token, callback='oob', user_agent='python-mwoauth default user agent' ) ¶ identify ( access_token ) print ( "Identified as. complete ( request_token, response_qs ) print ( str ( access_token )) # Step 4: Identify - (optional) get identifying information about the # user identity = handshaker. initiate () # Step 2: Authorize - send user to MediaWiki to confirm authorization print ( "Point your browser to: %s " % redirect ) # response_qs = input ( "Response query string: " ) # Step 3: Complete - obtain authorized key/secret for "resource owner" access_token = handshaker. consumer_secret ) # Construct handshaker with wiki URI and consumer handshaker = Handshaker ( "", consumer_token ) # Step 1: Initialize - ask MediaWiki for a temporary key/secret for # user redirect, request_token = handshaker. From mwoauth import ConsumerToken, Handshaker from six.moves import input # For compatibility between python 2 and 3 # Consruct a "consumer" from the key/secret provided by MediaWiki import config consumer_token = ConsumerToken ( config.