code: def authenticate_redirect(self, callback_uri=None, cancel_uri=None,
                                extended_permissions=None, callback=None):
          
          self.require_setting(self._CLIENT_ID_SETTING, self._API_NAME)
  
          scope = self._BASE_SCOPE
          if extended_permissions:
              scope += extended_permissions
  
          args = {'client_id': self.settings[self._CLIENT_ID_SETTING],
                  'redirect_uri': self.oauth2_redirect_uri(callback_uri),
                  'scope': ','.join(scope)}
  
          # If cookie_secret is set, use it for GitHub's state value
          if not self.state and 'cookie_secret' in self.settings:
              sha1 = hashlib.sha1(self.settings['cookie_secret'])
              self.state = str(sha1.hexdigest())
  
          # If state is set, add it to args
          if self.state:
              args['state'] = self.state
  
          LOGGER.info('Redirect args: %r', args)
  
          # Redirect the user to the proper URL
          self.redirect(self._OAUTH_AUTHORIZE_URL +
                        auth.urllib_parse.urlencode(args))
          callback()
docs: Perform the authentication redirect to GitHub