如何解决Doom Emacs Clojure 谷歌授权码
我在 Windows 10 中运行 doom emacs,用于 clojure。基于
Sparkfund google-apps-clj.credentials/get-auth-map
函数,
_ (println "Please visit the following url and input the code "
"that appears on the screen: " auth-url)
请访问以下网址并输入屏幕上显示的代码:https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=1080463043693...www.googleapis.com/auth/spreadsheets "
在我的 emacs repl 中给我链接,然后我将链接复制并粘贴到我的浏览器中,它返回一个可复制的授权代码 4/1AY0e-g5z1hqNhJtLosomecodezSnx5gEGOk
。
问题是,我如何将授权码粘贴到我的 REPL 中? repl 仍然停留在 println 中,我不得不按 Ctrl+C+ Ctrl+C 来终止进程。
它应该在我获得授权码后给出令牌。因为还有这段代码来完成这个功能。请帮忙?
auth-code (doto ^String (read-line) assert)
token-request (doto (.newTokenRequest auth-flow auth-code)
assert
(.setRedirectUri "urn:ietf:wg:oauth:2.0:oob"))]
(doto (.execute token-request)
assert)))
(defn get-auth-map
"Given a google-ctx configuration map,and a list of scopes(as strings),creates a URL for the user to receive their auth-code,which is then used
to receive an authorization map,which the user should store securely"
[google-ctx scope]
(let [google-secret (get-google-secret google-ctx)
auth-flow-builder (doto (GoogleAuthorizationCodeFlow$Builder. http-transport json-factory
google-secret scope)
(.setAccesstype "offline"))
auth-flow (doto (.build auth-flow-builder)
assert)
auth-request-url (doto (.newAuthorizationUrl auth-flow)
assert
(.setRedirectUri "urn:ietf:wg:oauth:2.0:oob"))
auth-url (.build auth-request-url)
_ (println "Please visit the following url and input the code "
"that appears on the screen: " auth-url)
auth-code (doto ^String (read-line) assert)
token-request (doto (.newTokenRequest auth-flow auth-code)
assert
(.setRedirectUri "urn:ietf:wg:oauth:2.0:oob"))]
(doto (.execute token-request)
assert)))
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。