XF 2.2 Why does my connected account information disappear after a few days?

Jaxel

Well-known member
When I first connect my Discord account, it shows up like this:

Untitled-1.png

Works fine. However, after a few days, the extraneous information, like the avatar, the username and the #discriminator code disappear.

Untitled-2.png

Where is this information stored? And why does it disappear after a few days?

This is my provider data:
Code:
<?php

namespace EWR\Discord\ConnectedAccount\ProviderData;

class Discord extends \XF\ConnectedAccount\ProviderData\AbstractProviderData
{
    public function getDefaultEndpoint()
    {
        return 'users/@me';
    }

    public function getProviderKey()
    {
        return $this->requestFromEndpoint('id');
    }

    public function getUsername()
    {
        return $this->requestFromEndpoint('username');
    }

    public function getDiscriminator()
    {
        return $this->requestFromEndpoint('discriminator');
    }

    public function getAvatar()
    {
        return $this->requestFromEndpoint('avatar');
    }

    public function getEmail()
    {
        return $this->requestFromEndpoint('email');
    }

    public function getVerified()
    {
        return $this->requestFromEndpoint('verified');
    }

    public function getAvatarUrl()
    {
        $avatar = $this->getAvatar();
        
        if (empty($avatar))
        {
            $discriminator = $this->getDiscriminator();
            return 'https://cdn.discordapp.com/embed/avatars/'.($discriminator%5).'.png';
        }
        else
        {
            $providerKey = $this->getProviderKey();
            return 'https://cdn.discordapp.com/avatars/'.$providerKey.'/'.$avatar.'.png';
        }
    }
}
 
The information is not stored on the system at all other than a temporary cache if I remember correctly. Once your OAuth token expires, it can't be fetched anymore and shows as unknown.

 
Top Bottom