From a1a5ccb76329d835adafdf117883199c92de44cb Mon Sep 17 00:00:00 2001 From: Jonathan Leech-Pepin Date: Fri, 14 Nov 2014 15:33:59 -0500 Subject: Updated `sx-request-make` to use a consistent format for both `POST` and `GET` methods. (sx-request-make): Added optional arguments for using "POST" and AUTH when performing requests (sx-request--build-keyword-arguments): Add option of using AUTH and including in query when required. (sx-request-build): Removed (sx-request--request): New function to perform query with all variables let bound. sx-auth.el: Updated `sx-auth-root` to be full auth URL rather than lack method. (sx-auth-authenticate): Remove dependency on `sx-request-build` and perform construction inline. --- sx-auth.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'sx-auth.el') diff --git a/sx-auth.el b/sx-auth.el index f32e7aa..4ccdd0e 100644 --- a/sx-auth.el +++ b/sx-auth.el @@ -28,7 +28,7 @@ (require 'sx-cache) (defconst sx-auth-root - "https://stackexchange.com/oauth/") + "https://stackexchange.com/oauth/dialog") (defconst sx-auth-redirect-uri "http://vermiculus.github.io/stack-mode/auth/auth.htm") (defconst sx-auth-client-id @@ -50,15 +50,18 @@ questions)." (interactive) (setq sx-auth-access-token - (let ((url (sx-request-build - "dialog" - `((client_id . ,sx-auth-client-id) - (scope . (read_inbox - no_expiry - write_access)) - (redirect_uri . ,(url-hexify-string - sx-auth-redirect-uri))) - "," sx-auth-root))) + (let ( + (url (concat + sx-auth-root + "?" + (sx-request--build-keyword-arguments + `((client_id . ,sx-auth-client-id) + (scope . (read_inbox + no_expiry + write_access)) + (redirect_uri . ,(url-hexify-string + sx-auth-redirect-uri))) + ",")))) (browse-url url) (read-string "Enter the access token displayed on the webpage: "))) (if (string-equal "" sx-auth-access-token) -- cgit v1.2.3 From 3593d62493b072b162abfec83a0e3081092738f0 Mon Sep 17 00:00:00 2001 From: Jonathan Leech-Pepin Date: Fri, 14 Nov 2014 15:56:01 -0500 Subject: Remove unneeded newline --- sx-auth.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sx-auth.el') diff --git a/sx-auth.el b/sx-auth.el index 4ccdd0e..b470523 100644 --- a/sx-auth.el +++ b/sx-auth.el @@ -50,8 +50,7 @@ questions)." (interactive) (setq sx-auth-access-token - (let ( - (url (concat + (let ((url (concat sx-auth-root "?" (sx-request--build-keyword-arguments -- cgit v1.2.3