Created
March 19, 2022 02:20
-
-
Save ranfysvalle02/78a3eb0b8f7385ab3a493926573bad6d to your computer and use it in GitHub Desktop.
Realm App Services - Function to Authenticate with the Enjin Platform
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
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