Worker uses the github access token

This commit is contained in:
Zoe Roux
2022-03-03 17:13:59 +01:00
parent 7271820644
commit c5bf43de37
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -17,6 +17,7 @@ license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
services/anilist.json
services/discord.json
services/github.json
services/spotify.json
+1 -1
View File
@@ -62,7 +62,7 @@ urlHandler Spotify (Just r) = do
urlHandler Github (Just r) = do
clientId <- liftIO $ envAsString "GITHUB_CLIENT_ID" ""
throwError $ err302 { errHeaders =
[("Location", B8.pack $ "https://github.com/login/oauth/authorize?response_type=code&client_id=" ++ clientId ++ "&redirect_uri=" ++ r)] }
[("Location", B8.pack $ "https://github.com/login/oauth/authorize?response_type=code&scope=repo&client_id=" ++ clientId ++ "&redirect_uri=" ++ r)] }
servicesHandler :: AuthRes -> AppM [String]
servicesHandler (Authenticated (User uid name slug)) = do
+4 -3
View File
@@ -10,10 +10,11 @@ export class Github extends BaseService {
private _github: Octokit;
private _websocket: Webhooks;
constructor(_: Pipeline) {
constructor(pipeline: Pipeline) {
super();
///TODO Get various credentials
this._github = new Octokit();
if (!("Github" in pipeline.userData))
throw new Error("User not authenticated via github");
this._github = new Octokit({auth: pipeline.userData["Github"].accessToken});
this._websocket = new Webhooks({
secret: "bidibi"
});