aboutsummaryrefslogtreecommitdiff
path: root/sx-auth.el
diff options
context:
space:
mode:
authorJonathan Leech-Pepin <jonathan.leechpepin@gmail.com>2014-11-14 15:33:59 -0500
committerJonathan Leech-Pepin <jonathan.leechpepin@gmail.com>2014-11-14 15:33:59 -0500
commita1a5ccb76329d835adafdf117883199c92de44cb (patch)
treec57977750aee4b7942479f563f43e40a0ca37fa7 /sx-auth.el
parent2d8c61963146ee8fc32684c47b3a3761320e671a (diff)
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.
Diffstat (limited to 'sx-auth.el')
-rw-r--r--sx-auth.el23
1 files changed, 13 insertions, 10 deletions
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)