diff --git a/.gitignore b/.gitignore index ac3cb06..7134639 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # Local Netlify folder .netlify -.env \ No newline at end of file +.env +node_modules \ No newline at end of file diff --git a/functions/untappd_callback/untappd_callback.js b/functions/untappd_callback/untappd_callback.js index 5fae114..85cf670 100644 --- a/functions/untappd_callback/untappd_callback.js +++ b/functions/untappd_callback/untappd_callback.js @@ -9,13 +9,13 @@ exports.handler = async (event, context) => { const redirect_url = process.env.UNTAPPD_REDIRECT_URL; const auth_url = `https://untappd.com/oauth/authorize/?client_id=${client_id}&client_secret=${client_secret}&response_type=code&redirect_url=${redirect_url}&code=${code}`; - let response_message = "default"; + let response_message = await request(auth_url); - response_message = await request(auth_url); + const access_token = response_message.response.access_token return { statusCode: 200, - body: JSON.stringify({ message: `${JSON.stringify(response_message)}` }), + body: JSON.stringify({ message: `${JSON.stringify(access_token)}` }), }; } catch (err) { return { statusCode: 500, body: err.toString() };