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:28:25 +0800 Message-ID: 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="129974"; mail-complaints-to="usenet@ciao.gmane.io" Cc: julien@danjou.info 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:29:14 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 1jHCeI-000Xir-1l for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Mar 2020 21:29:14 +0100 Original-Received: from localhost ([::1]:42838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHCeH-0000SW-3w for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Mar 2020 16:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37287) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHCe8-0000SE-Jm for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:29:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHCe6-0003xz-JA for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:29:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51826) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHCe6-0003xp-GB for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jHCe6-0007IH-Cx for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Xu Chunyang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Mar 2020 20:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40228 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158516812227991 (code B ref -1); Wed, 25 Mar 2020 20:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Mar 2020 20:28:42 +0000 Original-Received: from localhost ([127.0.0.1]:57799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHCdl-0007HP-Py for submit@debbugs.gnu.org; Wed, 25 Mar 2020 16:28:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHCdk-0007HH-7j for submit@debbugs.gnu.org; Wed, 25 Mar 2020 16:28:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37214) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHCdj-0000Rt-5k for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:28:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHCdi-0003c0-7t for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:28:39 -0400 Original-Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:33154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHCdi-0003bg-3r for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 16:28:38 -0400 Original-Received: by mail-oi1-x230.google.com with SMTP id m14so3452101oic.0 for ; Wed, 25 Mar 2020 13:28:37 -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:cc; bh=IU8/hGj21+lPw3iGW43ZGhNCdd1o3h4dxHpgHi7yWSQ=; b=nsyrZv1n8WrlaVDZJwAJJLiDNEVIfi6/Gkaz5sIGTgkGRh/1VnB6eZzBclgiK5QGq+ vHfEFUGKS9uDoxXLGLOXBtyDaiOKyHIlWCRnifuBhJfuoxX8gFrT/liWmWA3v0/ouVYY CiHbdF6tl1ZfbuXC2OPOYfWQ+wPoqPsXcKD7QDna92KZ2VCKjRdPkirRJ0eIGPbQFcmg 5LSi0z7iEP520sep0F5q1GMcFIDADdkdm9DZuC7W32GKxKX7p818HOzeR+18hlTPAERG em/aVhTFcRJuMkIzMovotcx+QMOJaqjgeGfD7EnDc5sTLkZLXsKl17SANmcnXpuh4f1c E/0g== 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:cc; bh=IU8/hGj21+lPw3iGW43ZGhNCdd1o3h4dxHpgHi7yWSQ=; b=ZxUm0wQ6oqMdx1eOEYZc4IJG/u+O+WuxdGf0EwRfwUhNpnp2cg2Fa3prj+y0ynTcTq SMilWLuQ0r/PHaTHai6rXVJcPKPJNK44pAhhzI3QXLPFVw6FOTbgz5o+nqxf9CfSIE2z mCfxG3tnXeqUfSS/eK9oURjVNzrPyhCyWeKEP9BNqPrQ7dtkFwmXAv5HnEiSDx39ToaV 14Y5lWbgZd2L7M5yuc6QN9jSIykRG9AkjvWcL0kx5ZRWBucVF5IoHr4/9YbGlFA/y74L couZ1U4bx4aDnS7JkUnJhILNaqPEXRsss63hvHBM1DTFSKYZ4q5zLAFSarE61hEw32a4 J73g== X-Gm-Message-State: ANhLgQ22TRx6Ss5khcMHjfWu5ym8BYhGHyoUpoOWpPvrqJirUaJz/g6X ZPF7hQe6NUjpovwBGMjm9/9FOxo37GqZelzggDkscYvts1lCpg== X-Google-Smtp-Source: ADFU+vtKnqk9KsGDIFOwn+pRtTWpeG4lyNpueeeDodgaR1+vEFOskayzWaOjnhxt3xCwjSDITVAUun7woJq1fTUE1ck= X-Received: by 2002:aca:8ce:: with SMTP id 197mr3689536oii.35.1585168116630; Wed, 25 Mar 2020 13:28:36 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:177716 Archived-At: Hi, I'm using an API which requires state, but oauth2-auth-and-store doesn't take one, hence this package, by the way, I changed resource-url to scope, the former looks like a typo. 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-9fSeJ8 --- /Users/xcy/.emacs.d/elpa-27.0.90/oauth2-0.11/oauth2.el +++ # @@ -149,7 +149,7 @@ (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)) @@ -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:23:21 2020