Social Buttons Load way too slow

I am using the user-account:core package, and the login works fine using third party services. The only problem is that on initial load, that every time the page is loaded, it takes a while for the login buttons to appear. How can this be avoided? Maybe a certain loading theme, or something? The text appears btw, like, Sign in and register. But the social buttons appear after some time.

Here’s my account-config.js

if (Meteor.isServer) {
    Meteor.startup(function() {
        // code to run on server at startup
        Accounts.loginServiceConfiguration.remove({
            service: "google"
        })
        Accounts.loginServiceConfiguration.insert({
            service: "google",
            clientId: "",
            secret: ""
        });
        Accounts.loginServiceConfiguration.remove({
            service: "github"
        })
        Accounts.loginServiceConfiguration.insert({
            service: "github",
            clientId: "",
            secret: "",
            requestPermission:'avatar_url'
        });
        Accounts.loginServiceConfiguration.remove({
            service: "twitter"
        })
        Accounts.loginServiceConfiguration.insert({
            service: "twitter",
            clientId: "",
            secret: ""
        });
        Accounts.loginServiceConfiguration.remove({
            service: "facebook"
        })
        Accounts.loginServiceConfiguration.insert({
            service: "facebook",
            appId: "",
            secret: ""
        });

        
    });
}

Is it because of the remove() function being called everytime?

It probably take some time cause it need to connect to these services to check if user is logged in.

Interesting you are providing requestPermission for github there, does it work?
I always kept it in accounts ui config.

And BTW, why not using syntax from official documentation http://docs.meteor.com/#/full/meteor_loginwithexternalservice

It is down there in service-configuration little subtopic showcased as

ServiceConfiguration.configurations.upsert(
  { service: "weibo" },
  {
    $set: {
      clientId: "1292962797",
      loginStyle: "popup",
      secret: "75a730b58f5691de5522789070c319bc"
    }
  }
);

Yeah, github works. And I will check that solution and reply soon. Thanks for the reply.

Does this happen when deploying your app locally? Or on meteor.com?

Typically while deploying to meteor.com servers.

BTW, I’m using my own domain name, but idk if that is responsible for this lag.

And this works. But the lag is still there. Wonder why would it be too slow to contact the services. Should a file an issue on the useraccounts github page?

What you are experiencing is the double effect of:

  1. Meteor not being good at serving static assets (in general)
  2. meteor.com being a laggy service

There are efficient solutions for both problems. See:

The first question refers to the amount of images in the public folder, but, why in this case, would Meteor be slow in showing up thirdparty services buttons? Are they like fethced from somewhere?

@abhisheksoni see my reply on your issue.

The thing is that the list of OAuth services comes from Accounts.loginServiceConfiguration which in turn picks it up from a collection.
That content is published here and subscribed to at client startup here.

So its really a matter of the accounts management and the only option we have is to rely on fast-render to send all the collection content on first page load.