class_docstr: Abstract implementation of OAuth 1.0 and 1.0a.
  
  See `TwitterMixin` below for an example implementation.
  
  Class attributes:
  
  * ``_OAUTH_AUTHORIZE_URL``: The service's OAuth authorization url.
  * ``_OAUTH_ACCESS_TOKEN_URL``: The service's OAuth access token url.
  * ``_OAUTH_VERSION``: May be either "1.0" or "1.0a".
  * ``_OAUTH_NO_CALLBACKS``: Set this to True if the service requires
    advance registration of callbacks.
  
  Subclasses must also override the `_oauth_get_user_future` and
  `_oauth_consumer_token` methods.
class_docstr_tok: ["Abstract","implementation","of","OAuth","1.0","and","1.0a",".","See","`","TwitterMixin","`","below","for","an","example","implementation",".","Class","attributes",":","*","``","_OAUTH_AUTHORIZE_URL","``",":","The","service","'s","OAuth","authorization","url",".","*","``","_OAUTH_ACCESS_TOKEN_URL","``",":","The","service","'s","OAuth","access","token","url",".","*","``","_OAUTH_VERSION","``",":","May","be","either","``","1.0","''","or","``","1.0a","''",".","*","``","_OAUTH_NO_CALLBACKS","``",":","Set","this","to","True","if","the","service","requires","advance","registration","of","callbacks",".","Subclasses","must","also","override","the","`","_oauth_get_user_future","`","and","`","_oauth_consumer_token","`","methods","."]
docstr: Redirects the user to obtain OAuth authorization for this service.
  
  The ``callback_uri`` may be omitted if you have previously
  registered a callback URI with the third-party service.  For
  some services (including Friendfeed), you must use a
  previously-registered callback URI and cannot specify a
  callback via this method.
  
  This method sets a cookie called ``_oauth_request_token`` which is
  subsequently used (and cleared) in `get_authenticated_user` for
  security purposes.
  
  Note that this method is asynchronous, although it calls
  `.RequestHandler.finish` for you so it may not be necessary
  to pass a callback or use the `.Future` it returns.  However,
  if this method is called from a function decorated with
  `.gen.coroutine`, you must call it with ``yield`` to keep the
  response from being closed prematurely.
  
  .. versionchanged:: 3.1
     Now returns a `.Future` and takes an optional callback, for
     compatibility with `.gen.coroutine`.
docstr_tok: ["Redirects","the","user","to","obtain","OAuth","authorization","for","this","service",".","The","``","callback_uri","``","may","be","omitted","if","you","have","previously","registered","a","callback","URI","with","the","third-party","service",".","For","some","services","(","including","Friendfeed",")",",","you","must","use","a","previously-registered","callback","URI","and","can","not","specify","a","callback","via","this","method",".","This","method","sets","a","cookie","called","``","_oauth_request_token","``","which","is","subsequently","used","(","and","cleared",")","in","`","get_authenticated_user","`","for","security","purposes",".","Note","that","this","method","is","asynchronous",",","although","it","calls","`",".RequestHandler.finish","`","for","you","so","it","may","not","be","necessary","to","pass","a","callback","or","use","the","`",".Future","`","it","returns",".","However",",","if","this","method","is","called","from","a","function","decorated","with","`",".gen.coroutine","`",",","you","must","call","it","with","``","yield","``","to","keep","the","response","from","being","closed","prematurely",".","..","versionchanged",":",":","3.1","Now","returns","a","`",".Future","`","and","takes","an","optional","callback",",","for","compatibility","with","`",".gen.coroutine","`","."]
code: def authorize_redirect(
      self,
      callback_uri=None,
      extra_params=None,
      http_client=None,
      callback=None,
  ):
      """Redirects the user to obtain OAuth authorization for this service.
  
      The ``callback_uri`` may be omitted if you have previously
      registered a callback URI with the third-party service.  For
      some services (including Friendfeed), you must use a
      previously-registered callback URI and cannot specify a
      callback via this method.
  
      This method sets a cookie called ``_oauth_request_token`` which is
      subsequently used (and cleared) in `get_authenticated_user` for
      security purposes.
  
      Note that this method is asynchronous, although it calls
      `.RequestHandler.finish` for you so it may not be necessary
      to pass a callback or use the `.Future` it returns.  However,
      if this method is called from a function decorated with
      `.gen.coroutine`, you must call it with ``yield`` to keep the
      response from being closed prematurely.
  
      .. versionchanged:: 3.1
         Now returns a `.Future` and takes an optional callback, for
         compatibility with `.gen.coroutine`.
      """
      if callback_uri and getattr(self, "_OAUTH_NO_CALLBACKS", False):
          raise Exception(
              "This service does not support oauth_callback"
          )
      if http_client is None:
          http_client = self.get_auth_http_client()
      if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a":
          http_client.fetch(
              self._oauth_request_token_url(
                  callback_uri=callback_uri, extra_params=extra_params
              ),
              functools.partial(
                  self._on_request_token,
                  self._OAUTH_AUTHORIZE_URL,
                  callback_uri,
                  callback,
              ),
          )
      else:
          http_client.fetch(
              self._oauth_request_token_url(),
              functools.partial(
                  self._on_request_token,
                  self._OAUTH_AUTHORIZE_URL,
                  callback_uri,
                  callback,
              ),
          )
  
imports: from __future__ import absolute_import, division, print_function
  import base64
  import binascii
  import functools
  import hashlib
  import hmac
  import time
  import uuid
  from tornado.concurrent import TracebackFuture, return_future, chain_future
  from tornado import gen
  from tornado import httpclient
  from tornado import escape
  from tornado.httputil import url_concat
  from tornado.log import gen_log
  from tornado.stack_context import ExceptionStackContext
  from tornado.util import unicode_type, ArgReplacer, PY3
label_desc: Use image node_id 1 for calling the OAuthMixin obj's underlying member method code with example usage: obj.authorize_redirect(callback_uri, extra_params, http_client, callback) without return types