From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Xu Chunyang Newsgroups: gmane.emacs.bugs Subject: bug#40228: [oauth2.el] oauth2-auth-and-store: Add optional argument state Date: Thu, 26 Mar 2020 04:32:06 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="18162"; mail-complaints-to="usenet@ciao.gmane.io" To: 40228@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 25 21:33:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jHCi8-0004az-Cd for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Mar 2020 21:33:12 +0100 Original-Received: from localhost ([::1]:42880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHCi7-0000wa-2P for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Mar 2020 16:33:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38178) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHChz-0000wU-Nh for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:33:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHChy-0006Xf-O6 for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51831) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHChy-0006Xb-Kk for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jHChy-0007Ql-Hj for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:33:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Xu Chunyang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Mar 2020 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40228 X-GNU-PR-Package: emacs Original-Received: via spool by 40228-submit@debbugs.gnu.org id=B40228.158516834528509 (code B ref 40228); Wed, 25 Mar 2020 20:33:02 +0000 Original-Received: (at 40228) by debbugs.gnu.org; 25 Mar 2020 20:32:25 +0000 Original-Received: from localhost ([127.0.0.1]:57804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHChN-0007Pk-A3 for submit@debbugs.gnu.org; Wed, 25 Mar 2020 16:32:25 -0400 Original-Received: from mail-ot1-f41.google.com ([209.85.210.41]:39077) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHChL-0007PT-Pl for 40228@debbugs.gnu.org; Wed, 25 Mar 2020 16:32:24 -0400 Original-Received: by mail-ot1-f41.google.com with SMTP id x11so3480005otp.6 for <40228@debbugs.gnu.org>; Wed, 25 Mar 2020 13:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=WpQ9AXWI5nFsekpDP4j1YiJOs6T95lA54a/RwLi2OJU=; b=esjl8Tr/5B7tCgimH6okzwDXgU/Sh3IX3XPPtBTXOK5iQ2D6lrnJpOhkDwNpgCMC/c valf1ZmOlJWKmyaziR98W6Vhl8jNysWxn+K3UbgeANXF6fzu5ZiMICEDOJZTk6oUtK3t +xkv6+zqzJf/AXJYPO9V3Vrt6mkFOVbz+a4YhkXMNG0wMRvpqVbb7K6tvdnsB9eA97lZ 6pwPVcZkPXf2VyM6ELlSC3iYU0oFoBcMbxHtOx//cHndvAZvYKLkdIchK9UjNCj6yB0M /D2dYtd+3ghDe4TT6EHodTySvhYtHB7dJ1D30ekrws6C+vemQ8E0hzMVR17DtIdAmoDB nSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=WpQ9AXWI5nFsekpDP4j1YiJOs6T95lA54a/RwLi2OJU=; b=BcML80W4OccxQjwE07hPNJnJ4vKRXp643FoB7bbrfcRrp8s8Oa+WZP5XqdZYUd2wYw c6TojfsCarb2/fzMsfCgHzkgRotRw2a4des2YZSVTRquKS7W6YbWwrZkWSVGofwX6ORP UY2Np1tQgWSIOb5PjJH8eehm9jRHCob8H0vUwE4MuJUTtMswkqtJo3sTbeJ+WwZEBbF0 lK+zD3P3gG4jK/W3FYQ77Y6dVmp0MLhmlGHw9BD0mDSsvXmIugbG45UiAYuzXohR1Ag5 kItu6R2v4DjVIOq7cryelcM5PwD3xNvBtAAuyOE5K08QbWmwhLWrk9iAHyx3DYxtvXPZ I5Sg== X-Gm-Message-State: ANhLgQ3B6COX9nYzyP5FjENJxLxugXwURfbcrL2mqHcKFUgsdB0UvSC7 8JoCyHbWUPX7sr+PWW/xQk/iitVnZIfgJTloAQ8gJrPHzYNKtA== X-Google-Smtp-Source: ADFU+vv5fO/6ARtixUq133a1XE2ETEzF23G3wm8DrRoXEmJoezGZSGduVkVTIIiZAarXc+4l2iJnkt1oJpK9l4taveA= X-Received: by 2002:a9d:64d4:: with SMTP id n20mr3697378otl.193.1585168337679; Wed, 25 Mar 2020 13:32:17 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177717 Archived-At: Oops, I forget changing all resource-url, here is the updated patch. diff -u --label /Users/xcy/.emacs.d/elpa-27.0.90/oauth2-0.11/oauth2.el --label \#\ /Users/xcy/.emacs.d/elpa-27.0.90/oauth2-0.11/oauth2.el /var/folders/7f/s191h4q97p90374yw15ssrs00000gn/T/buffer-content-3H8LwW --- /Users/xcy/.emacs.d/elpa-27.0.90/oauth2-0.11/oauth2.el +++ # @@ -149,11 +149,11 @@ (secure-hash 'md5 (concat auth-url token-url resource-url))) ;;;###autoload -(defun oauth2-auth-and-store (auth-url token-url resource-url client-id client-secret &optional redirect-uri) +(defun oauth2-auth-and-store (auth-url token-url scope client-id client-secret &optional redirect-uri state) "Request access to a resource and store it using `plstore'." ;; We store a MD5 sum of all URL (let* ((plstore (plstore-open oauth2-token-file)) - (id (oauth2-compute-id auth-url token-url resource-url)) + (id (oauth2-compute-id auth-url token-url scope)) (plist (cdr (plstore-get plstore id)))) ;; Check if we found something matching this access (if plist @@ -167,7 +167,7 @@ :token-url token-url :access-response (plist-get plist :access-response)) (let ((token (oauth2-auth auth-url token-url - client-id client-secret resource-url nil redirect-uri))) + client-id client-secret scope state redirect-uri))) ;; Set the plstore (setf (oauth2-token-plstore token) plstore) (setf (oauth2-token-plstore-id token) id) Diff finished. Thu Mar 26 04:31:13 2020