Doom Emacs Clojure Google 授权码

Doom Emacs Clojure Google Authorization Code

我 运行 厄运 emacs 在 windows 10,用于 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)

Please visit the following url and input the code that appears on the screen: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=1080463043693...www.googleapis.com/auth/spreadsheets "

在我的 emacs repl 中给我 link,然后我在我的浏览器中复制并粘贴 link,它 return 一个可复制的授权码 4/1AY0e-g5z1hqNhJtLosomecodezSnx5gEGOk.

问题是,如何将授权码粘贴到我的 REPL 中? repl 仍然卡在 println 中,我不得不按 Ctrl+C+ Ctrl+C 来终止进程。

应该是拿到授权码后给token的。因为还有这段代码来完成这个功能。请帮忙?

    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)))

太傻了,我需要在

之后输入授权码

Stdin : paste-your-auth-code-here

位于emacs 底部!然后按回车