TypeScript & ServiceConfiguration for Angular 2 App

Hi All,

I am trying to use ServiceConfiguration in a TypeScript module (using Angular 2) to create a custom social logins.

I cannot find the package to import into my Typescript file.
I have installed the “service-configuration” in the project.

It seems I have to use javascript.
Any thoughts so that I can have my app modulaized?

Thanks,
Greg

1 Like

can someone help? same issue

  1. You can creaet your own typings…a bit over kill.
  2. Ignore the error
  3. I just put it all in its own javascript file and imported it in the server/main.ts file

import ‘./imports/service-config.js’;

can you elaborate more?
I have service-config.js in server folder with this code:

 function face() {
    ServiceConfiguration.configurations.upsert(
        {service: "facebook"},
        {$set: {clientId: "1547032938932069", secret: "af1ff2bd66da2ad5ff382455abe57f43"}}
    );
}

I wrote in main.ts this:
import './service-config.js';

but how can I call in main.ts the function from social-config.js now?

  1. Create a javascript file in the server folder…names “service-config.js”. Here is my example. I use the Meteor.settings service (see: https://themeteorchef.com/recipes/roll-your-own-authentication/#tmc-setting-up-oauth-services). My .js file in entirety.

import { Meteor } from ‘meteor/meteor’;

Meteor.startup(() => {
ServiceConfiguration.configurations.remove({
service: “twitter”
});
ServiceConfiguration.configurations.insert({
service: “twitter”,
consumerKey: Meteor.settings.private.oAuth.twitter.consumerKey,
loginStyle: “popup”,
secret: Meteor.settings.private.oAuth.twitter.secret
});
});

  1. in the main.ts use the include, to include that file. Yes, they both can have a Meteor.startup() implementation.

import ‘./imports/service-config.js’;

you write that in .js? mine complaining on a lot of errors

import { Meteor } from ‘meteor/meteor’;

Meteor.startup(() => {
ServiceConfiguration.configurations.remove({
service: "twitter"
});
ServiceConfiguration.configurations.insert({
service: "twitter",
consumerKey: Meteor.settings.private.oAuth.twitter.consumerKey,
loginStyle: "popup",
secret: Meteor.settings.private.oAuth.twitter.secret
});
});