function GetStoreSessionID( callback )
{
	if( storeSessionId )
	{
		callback( { success: true, sessionID: storeSessionId } );
		return;
	}

	const url = 'https://store.steampowered.com/account/preferences';

	fetch( url, {
		credentials: 'include',
		headers: {
			// We have to specify that we're doing a normal request (as if the user was navigating).
			// This will trigger login.steampowered.com redirect flow if user has expired cookies.
			Accept: 'text/html',
		},
	} )
		.then( ( response ) => response.text() )
		.then( ( response ) =>
		{
			const session = response.match( /g_sessionID = "(\w+)";/ );

			if( session?.[ 1 ] )
			{
				storeSessionId = session[ 1 ];

				callback( { success: true, sessionID: session[ 1 ] } );
			}
			else
			{
				callback( {
					success: false,
					error: response.includes( 'login' )
						? 'Failed to fetch sessionid. It does not look like you are logged in to the Steam store.'
						: 'Failed to fetch sessionid. Something went horribly wrong, you should report this issue.',
				} );
			}
		} )
		.catch( ( error ) => callback( { success: false, error: error.message } ) );
}
@param {(obj: {success: true, sessionID: string}|{success: false, error: string}) => void} callback