Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require('axios');
- module.exports.main = async (event) => {
- const { code } = event.queryStringParameters;
- let accessToken = null;
- await axios({
- method: 'post',
- url: `https://login.eveonline.com/oauth/token?grant_type=authorization_code&code=${code}`,
- auth: {
- username: process.env.CLIENT_ID,
- password: process.env.CLIENT_SECRET,
- },
- headers: {
- accept: 'application/json',
- },
- }).then((response) => {
- accessToken = response.data.access_token;
- });
- return {
- statusCode: 301,
- body: JSON.stringify({ result: 'ok' }),
- headers: {
- 'Access-Control-Allow-Origin': '*',
- 'Access-Control-Allow-Credentials': true,
- Location: 'https://dgwxfhbva6lnp.cloudfront.net',
- 'Set-Cookie': `evi-auth-token=${accessToken}; Secure; Domain=dgwxfhbva6lnp.cloudfront.net; HttpOnly`,
- },
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement