Command Puling up certain user and not current user. Need help with this STAT!

So the soft launch is today. I have one bug I found. This command should be pulling up the information of the current user(it runs if there is already an active session) but when I try from another account it pulls up my user information:

const accessToken = “[redacted]”;
const response = await fetch(‘https://portal.hawxservices.com/api/v1/users/me’, {
headers: {
Authorization: SSWS ${accessToken},
redirectUri: ‘Hawx Redirect’,
Accept: ‘application/json’,
ContentType: ‘application/json’
}
});

                    const user = await response.json();
                    const firstName = user.profile.firstName;
                    const lastName = user.profile.lastName;
                    const email = user.profile.email;
                    const phone = user.profile.mobilePhone || 'N/A';

                    console.log({ firstName, lastName, email, phone });

                    document.getElementById("messageBox").innerHTML = "Hello, " + firstName + " " + lastName + "! Please wait while your information is updated.";

Thanks! I gotta fix this fast!

Fixed it. Turns out the access token also determines which user you pull up, since this was my access token it pulled me up.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.