Skip to content

Commit

Permalink
fix for undetected error
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Nov 3, 2019
1 parent 7754192 commit 26876dd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/get-oauth-authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@ export async function getOAuthAuthentication(
redirect_uri: options.redirectUrl
};

const response = await request(route, parameters);

if (response.data.error !== undefined) {
throw new Error(
response.data.error_description || `Unknown error: ${response.data.error}`
);
}

const {
data: { access_token: token, scope }
} = await request(route, parameters);
} = response;

return {
type: "token",
Expand Down

0 comments on commit 26876dd

Please sign in to comment.