Skip to content

Commit

Permalink
Merge pull request #37 from caravanapp-ca/fix/auth-3
Browse files Browse the repository at this point in the history
Round 3 for auth fix
  • Loading branch information
quinnturner committed May 31, 2020
2 parents db5c1f5 + a452e38 commit 6b6b009
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/web-api/src/services/discord.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios from 'axios';
import btoa from 'btoa';
import Discord, { TextChannel } from 'discord.js';
import FormData from 'form-data';
Expand Down Expand Up @@ -92,10 +91,12 @@ const ReadingDiscordBot = (() => {
},

getMe: async (accessToken: string) => {
const userResponse = await axios.get(`${DiscordApiUrl}/users/@me`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return userResponse.data as DiscordUserResponseData;
const data = await fetch(`${DiscordApiUrl}/users/@me`, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
}).then(res => res.json() as Promise<DiscordUserResponseData>);
return data;
},

getToken: async (code: string, host: string) => {
Expand Down

0 comments on commit 6b6b009

Please sign in to comment.