Last active
December 10, 2019 11:23
-
-
Save jackrobertscott/6496246156ebebfcf83a66e49d6be410 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
async function getAccessTokenFromCode(code) { | |
const { data } = await axios({ | |
url: 'https://graph.facebook.com/v4.0/oauth/access_token', | |
method: 'get', | |
params: { | |
client_id: process.env.APP_ID_GOES_HERE, | |
client_secret: process.env.APP_SECRET_GOES_HERE, | |
redirect_uri: 'https://www.example.com/authenticate/facebook/', | |
code, | |
}, | |
}); | |
console.log(data); // { access_token, token_type, expires_in } | |
return data.access_token; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment