|
|
|
@ -12,7 +12,7 @@
|
|
|
|
;; authenticates the user via username and password
|
|
|
|
;; authenticates the user via username and password
|
|
|
|
(gethash "AccessToken"
|
|
|
|
(gethash "AccessToken"
|
|
|
|
(json-request (format-url domain "Users/AuthenticateByName")
|
|
|
|
(json-request (format-url domain "Users/AuthenticateByName")
|
|
|
|
(generate-authorization)
|
|
|
|
:auth (generate-authorization)
|
|
|
|
:method :post
|
|
|
|
:method :post
|
|
|
|
:content `(("Username" . ,(getf options :username))
|
|
|
|
:content `(("Username" . ,(getf options :username))
|
|
|
|
("Pw" . ,(getf options :password))))))))
|
|
|
|
("Pw" . ,(getf options :password))))))))
|
|
|
|
@ -23,7 +23,7 @@
|
|
|
|
(defun quick-connect-dance (domain)
|
|
|
|
(defun quick-connect-dance (domain)
|
|
|
|
(let* ((auth (generate-authorization))
|
|
|
|
(let* ((auth (generate-authorization))
|
|
|
|
(qc-session (handler-case
|
|
|
|
(qc-session (handler-case
|
|
|
|
(json-request (format-url domain "QuickConnect/Initiate") auth)
|
|
|
|
(json-request (format-url domain "QuickConnect/Initiate") :auth auth)
|
|
|
|
(dex:http-request-unauthorized ()
|
|
|
|
(dex:http-request-unauthorized ()
|
|
|
|
(error "QuickConnect not enabled on this server.")))))
|
|
|
|
(error "QuickConnect not enabled on this server.")))))
|
|
|
|
;; initiate quick connect session
|
|
|
|
;; initiate quick connect session
|
|
|
|
@ -44,7 +44,7 @@
|
|
|
|
(sleep 5)
|
|
|
|
(sleep 5)
|
|
|
|
(let ((state (json-request (format-url domain "QuickConnect/Connect?secret=~A"
|
|
|
|
(let ((state (json-request (format-url domain "QuickConnect/Connect?secret=~A"
|
|
|
|
(gethash "Secret" qc-session))
|
|
|
|
(gethash "Secret" qc-session))
|
|
|
|
auth)))
|
|
|
|
:auth auth)))
|
|
|
|
(setf authed (gethash "Authenticated" state)
|
|
|
|
(setf authed (gethash "Authenticated" state)
|
|
|
|
counter (1+ counter)))
|
|
|
|
counter (1+ counter)))
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,7 +52,8 @@
|
|
|
|
(when (> counter 20)
|
|
|
|
(when (> counter 20)
|
|
|
|
(error "QuickConnect session timed out.")))
|
|
|
|
(error "QuickConnect session timed out.")))
|
|
|
|
(gethash "AccessToken"
|
|
|
|
(gethash "AccessToken"
|
|
|
|
(json-request (format-url domain "Users/AuthenticateWithQuickConnect") auth
|
|
|
|
(json-request (format-url domain "Users/AuthenticateWithQuickConnect")
|
|
|
|
|
|
|
|
:auth auth
|
|
|
|
:method :post
|
|
|
|
:method :post
|
|
|
|
:content (jzon:stringify (alist-hash-table `(("Secret" . ,(gethash "Secret" qc-session)))))
|
|
|
|
:content (jzon:stringify (alist-hash-table `(("Secret" . ,(gethash "Secret" qc-session)))))
|
|
|
|
:extra-headers '(("Content-Type" . "application/json"))))))
|
|
|
|
:extra-headers '(("Content-Type" . "application/json"))))))
|
|
|
|
|