You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i have some questions. How can i use env "variables" inside fetches? (marked with 1)
And how is the authorization variable working? I think in the fetch the two """ are missing. I dont think fetch work without it but i dont know.
Hello, i have some questions. How can i use env "variables" inside fetches? (marked with 1)
And how is the authorization variable working? I think in the fetch the two """ are missing. I dont think fetch work without it but i dont know.
My code:
`const fs = require('fs');
const fetch = require('node-fetch');
require('dotenv').config();
var authorization = "Bearer ";
console.log(process.env)
console.log(
Logging in as ${process.env.MSP_USERNAME}...\n
);console.log(process.env);
//get refresh token
fetch("https://eu.mspapis.com/loginidentity/connect/token", {
"headers": {
"accept": "/",
"accept-language": "en-GB,en;q=0.9,en-US;q=0.8,sv;q=0.7",
"content-type": "application/x-www-form-urlencoded",
"sec-ch-ua": ""Chromium";v="92", " Not A;Brand";v="99", "Microsoft Edge";v="92"",
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site"
},
"referrer": "https://moviestarplanet2.de/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body":
client_id=unity.client&client_secret=secret&grant_type=password&scope=openid%20nebula%20offline_access&username=DE%7c${process.env.MSP_USERNAME}&password=${process.env.MSP_PASSWORD}&acr_values=gameId%3aj68d
,"method": "POST",
"mode": "cors"
}).then(res => res.json())
.then(loginidentity => {
if (loginidentity.error) return console.error(
Error found
, loginidentity);console.log(
Success! Logged in as ${process.env.MSP_USERNAME}.\n
)//start of own code
//111111111111111111111111111111111111111111111111111111111111111111111111
//hier muss userId geändert werden
fetch("https://eu.mspapis.com/timelimitedrewards/v1/profiles/${process.env.MSP_ID}/games/j68d/rewards/daily_pickup", {
"headers": {
"accept": "/",
"accept-language": "de-DE,de;q=0.9",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site"
},
"referrer": "https://moviestarplanet2.de/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "OPTIONS",
"mode": "cors"
});
//222222222222222222222222222222222222222222
//hier muss userId geändert werden
//hier muss bearer verändert werden (vvlt schon gefixt mit variable "authorization") -----glaube nein
fetch("https://eu.mspapis.com/timelimitedrewards/v1/profiles/${process.env.MSP_ID}/games/j68d/rewards/daily_pickup", {
"headers": {
"accept": "/",
"accept-language": "de-DE,de;q=0.9",
"authorization": authorization,
"content-type": "application/json",
"sec-ch-ua": ""Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"",
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site"
},
"referrer": "https://moviestarplanet2.de/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "{"state":"Claimed"}",
"method": "PUT",
"mode": "cors"
});});});
`
The text was updated successfully, but these errors were encountered: