Skip to content

Commit

Permalink
Set app credentials for oauth via environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jsl committed Feb 23, 2012
1 parent 45c5de2 commit 27d3205
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -5,6 +5,9 @@ on one screen.

## Usage

You must first register this as a github application in order to use Oauth, and set environment variables
for GITHUB_CLIENT_ID and GITHUB_SECRET.

```bash
lein deps
lein run
Expand Down
6 changes: 3 additions & 3 deletions src/pull_panel/views/welcome.clj
Expand Up @@ -76,7 +76,7 @@
(defpage "/auth/github" []
(resp/redirect
(str "https://github.com/login/oauth/authorize?"
"client_id=666cd88453afcf920804&"
"client_id=" (get (System/getenv) "GITHUB_CLIENT_ID") "&"
"redirect_uri=https://pullpanel.herokuapp.com/auth/github-callback&"
"scope=repo")))

Expand Down Expand Up @@ -105,8 +105,8 @@

(defpage "/auth/github-callback" {:keys [code]}
(let [res (client/post "https://github.com/login/oauth/access_token"
{:form-params {:client_id "666cd88453afcf920804"
:client_secret "7847bee8ba503fadb9b6f65d1dce4fbf4d336762"
{:form-params {:client_id (get (System/getenv) "GITHUB_CLIENT_ID")
:client_secret (get (System/getenv) "GITHUB_SECRET")
:code code }
:accept :json})]
((session/put! :token ((json/parse-string (res :body)) "access_token"))
Expand Down

0 comments on commit 27d3205

Please sign in to comment.