Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ranfysvalle02/78a3eb0b8f7385ab3a493926573bad6d to your computer and use it in GitHub Desktop.
Save ranfysvalle02/78a3eb0b8f7385ab3a493926573bad6d to your computer and use it in GitHub Desktop.
Realm App Services - Function to Authenticate with the Enjin Platform
exports = async function (payloadObj) {
const axios = require('axios').default;
axios.defaults.headers.common = {
"Content-Type": "application/json",
};
let x = await axios({
url: 'https://cloud.enjin.io/graphql/default',
method: 'post',
data: {
query: `
query GetAccessToken{
AuthApp(id:`+payloadObj.query.app_id+`, secret: "`+payloadObj.query.secret+`"){
accessToken
expiresIn
}
}
`
}
});
return x.data
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment