code: def login(remote_app):
      
      oauth = current_app.extensions['oauthlib.client']
  
      if remote_app not in oauth.remote_apps:
          return abort(404)
  
      # Get redirect target in safe manner.
      next_param = get_safe_redirect_target(arg='next')
  
      # Redirect URI - must be registered in the remote service.
      callback_url = url_for(
          '.authorized',
          remote_app=remote_app,
          _external=True,
      )
  
      # Create a JSON Web Token that expires after OAUTHCLIENT_STATE_EXPIRES
      # seconds.
      state_token = serializer.dumps({
          'app': remote_app,
          'next': next_param,
          'sid': _create_identifier(),
      })
  
      return oauth.remote_apps[remote_app].authorize(
          callback=callback_url,
          state=state_token,
      )
docs: Send user to remote application for authentication.