Skip to content

Commit

Permalink
fix(samples): fix url parsing in sampleClient (#1462)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Nov 27, 2018
1 parent 5102efd commit d27de2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion samples/oauth2.js
Expand Up @@ -60,7 +60,8 @@ async function authenticate(scopes) {
.createServer(async (req, res) => {
try {
if (req.url.indexOf('/oauth2callback') > -1) {
const qs = new url.URL(req.url).searchParams;
const qs = new url.URL(req.url, 'http://localhost:3000')
.searchParams;
res.end('Authentication successful! Please return to the console.');
server.destroy();
const {tokens} = await oauth2Client.getToken(qs.get('code'));
Expand Down
3 changes: 2 additions & 1 deletion samples/sampleclient.js
Expand Up @@ -85,7 +85,8 @@ class SampleClient {
.createServer(async (req, res) => {
try {
if (req.url.indexOf('/oauth2callback') > -1) {
const qs = new url.URL(req.url).searchParams;
const qs = new url.URL(req.url, 'http://localhost:3000')
.searchParams;
res.end(
'Authentication successful! Please return to the console.'
);
Expand Down

0 comments on commit d27de2e

Please sign in to comment.