Skip to content

Commit

Permalink
chore: Minor tweaks (#485)
Browse files Browse the repository at this point in the history
chore: Minor tweaks
  • Loading branch information
liyasthomas committed Jan 11, 2020
2 parents d13e6f1 + caf33ba commit f1b22e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions assets/js/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const redirectUri = `${window.location.origin}/`;

// Make a POST request and parse the response as JSON
const sendPostRequest = async (url, params) => {
let body = Object.keys(params)
const body = Object.keys(params)
.map(key => `${key}=${params[key]}`)
.join("&");
const options = {
Expand All @@ -29,8 +29,8 @@ const parseQueryString = string => {
if (string === "") {
return {};
}
let segments = string.split("&").map(s => s.split("="));
let queryString = {};
const segments = string.split("&").map(s => s.split("="));
const queryString = {};
segments.forEach(s => (queryString[s[0]] = s[1]));
return queryString;
};
Expand Down Expand Up @@ -70,7 +70,7 @@ const sha256 = plain => {
};
// Base64-urlencodes the input string
const base64urlencode = (
str // Convert the ArrayBuffer to string using Uint8 array to conver to what btoa accepts.
str // Convert the ArrayBuffer to string using Uint8 array to convert to what btoa accepts.
) =>
// btoa accepts chars only within ascii 0-255 and base64 encodes them.
// Then convert the base64 encoded to base64url encoded
Expand All @@ -81,7 +81,7 @@ const base64urlencode = (
.replace(/=+$/, "");
// Return the base64-urlencoded sha256 hash for the PKCE challenge
const pkceChallengeFromVerifier = async v => {
let hashed = await sha256(v);
const hashed = await sha256(v);
return base64urlencode(hashed);
};

Expand Down

0 comments on commit f1b22e7

Please sign in to comment.