Retrieving profile picture of user is not working as intended

Repl link: https://replit.com/@AdvancedAPI/UnimportantTrustworthyMuse
When trying to use profilePicture as an image source, the image does not render. Any thoughts?

Where is profilepicture defined? And why are you using document.write? You could just change the elements attributes.

Yes, I am aware about document.write.

profilePicture is defined in the head element.

Oh, sorry I am blind? Can you give us the dev-console output/more detail about your error?

It looks like it’s working for me, did you fix it? If you did you should probably say so =P

2 Likes

No, I have not made any changes to the code.

There is no dev console output, and I see this image when visiting the page.
image

This is the issue with mine too, it just says undefined. Can you paste the html code after you have logged in?
I also noticed your tag is:

  <script src="https://replit.com/public/js/repl-auth-v2.js"></script>

instead of

    <script
      authed="location.reload()"
      src="https://replit.com/public/js/repl-auth-v2.js"
    ></script>
1 Like

Changed that, didn’t seem to work. What do you mean by “paste the html code after you have logged in?”

Once you have clicked “login with replit” and logged in, just copy the pages html, otherwise the result of the write call.

I can take a screenshot of the page after logging in. Is that fine?

No, best would be the html. Just open up chrome dev tools, click the html element, Edit as html, then copy.

Here, I got it…

<html>

<head>
  <style>
    body {
      background-color: lightskyblue;
    }
  </style>
</head>

<body>
  <center>
    QwertyQwerty54<br>
    Hi, I'm Qwerty. I know Python, Lua, and a bit of JS.
    
    Use my Replit Ask inv pls: https://ask.replit.com/invites/9hrxxB23vU<br>
    <img src="https://storage.googleapis.com/replit/images/1665087958774_90d83ab11e6cd1aa072054472027c785.png"><br>
    RotoBit-Studios,Custom-Language,TheAskExperiment,PageBlock,chat-website,replyte-dev
  </center>
</body>

</html>

But does it work for you? If it does it is not helpful.

Yeah, it works. Also, I’ve figured out the problem. @AdvancedAPI1 doesn’t have a PFP on Replit. When you don’t have a PFP, the header just returns nothing.

1 Like

I was noticing that too, I get undefined in the src field since I have no pfp, just checked, OP does not have one either. You just got the message first.

1 Like

Interesting, thought that might be the issue earlier, but it seemed like the default profile picture counted as a profile picture.

1 Like

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