OAuth Services Configuration
Meteor provides built-in support for OAuth authentication with several popular services. This guide will help you set up OAuth providers for your Meteor application.
Configuration
After registering your application with an OAuth provider, you need to configure the credentials in your Meteor app. There are several ways to do this:
Using settings.json (Recommended)
In your settings.json add:
{
"packages": {
"service-configuration": {
"facebook": {
"appId": "YOUR_APP_ID",
"secret": "YOUR_APP_SECRET"
},
"google": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
},
"github": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
},
"twitter": {
"consumerKey": "YOUR_CONSUMER_KEY",
"secret": "YOUR_CONSUMER_SECRET"
},
"meetup": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
},
"weibo": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
},
"meteor-developer": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Another optional setting by each service is
loginStylewhich can be set toredirectorpopup.
Then start your app with:
meteor --settings settings.jsonIn addition to the official services, you can also configure community/custom OAuth services through the service-configuration package as well.
Using ServiceConfiguration (Programmatic)
You can also configure OAuth services programmatically in your server code:
import { ServiceConfiguration } from 'meteor/service-configuration';
// Configure Facebook
ServiceConfiguration.configurations.upsertAsync(
{ service: 'facebook' },
{
$set: {
appId: 'YOUR_APP_ID',
secret: 'YOUR_APP_SECRET'
}
}
);
// Configure Google
ServiceConfiguration.configurations.upsertAsync(
{ service: 'google' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);Facebook
Setting up Facebook OAuth
Click "Create App" and fill out the required information.
In Use cases select Authenticate and request data from users with Facebook Login
In the app dashboard, click "Add Product" and find "Facebook Login", then click "Set Up"
Select "Web" as your platform
In the "Facebook Login > Settings" from the left sidebar, set "Valid OAuth Redirect URIs" to
YOUR_SITE_URL/_oauth/facebook(e.g.,http://localhost:3000/_oauth/facebook) and click "Save Changes"Go to "Settings > Basic" in the left sidebar
8Note down your "App ID" and "App Secret" (click "Show" to reveal the App Secret). You'll need these for configuration
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"facebook": {
"appId": "YOUR_APP_ID",
"secret": "YOUR_APP_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'facebook' },
{
$set: {
appId: 'YOUR_APP_ID',
secret: 'YOUR_APP_SECRET'
}
}
);Google
Setting up Google OAuth
Create a new project or select an existing one
In the left sidebar, go to "APIs & Services" > "OAuth consent screen"
Configure the consent screen: select "External" user type, enter your app name, user support email, and developer contact email, then click "Save and Continue"
Skip the "Scopes" step (or add scopes if needed) and click "Save and Continue"
Add test users if needed, then click "Save and Continue"
In the left sidebar, go to "Credentials" and click "Create Credentials" > "OAuth client ID"
Select "Web application" as the application type
Add your site URL to "Authorized JavaScript origins" (e.g.,
http://localhost:3000)Add
YOUR_SITE_URL/_oauth/googleto "Authorized redirect URIs" (e.g.,http://localhost:3000/_oauth/google)Click "Create" and note down your "Client ID" and "Client Secret" from the popup
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"google": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'google' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);GitHub
Setting up GitHub OAuth
Set Homepage URL to your site URL (e.g.,
http://localhost:3000for development orhttps://yourdomain.comfor production)Set Authorization callback URL to
YOUR_SITE_URL/_oauth/github(e.g.,http://localhost:3000/_oauth/github)Click "Register application"
Note down your Client ID and Client Secret
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"github": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'github' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);X/Twitter
Setting up X/Twitter OAuth
Visit https://developer.x.com/en/portal/dashboard and sign in
Create a new project and app (or select an existing one)
In your app settings, click on "Set up" under "User authentication settings"
Enable "OAuth 1.0a" (required for Meteor)
Set "Callback URI / Redirect URL" to
YOUR_SITE_URL/_oauth/twitter(e.g.,http://localhost:3000/_oauth/twitter)Set "Website URL" to your site URL (e.g.,
http://localhost:3000)Click "Save"
Go to the "Keys and tokens" tab and note down your "API Key" (Consumer Key) and "API Key Secret" (Consumer Secret)
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"twitter": {
"consumerKey": "YOUR_CONSUMER_KEY",
"secret": "YOUR_CONSUMER_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'twitter' },
{
$set: {
consumerKey: 'YOUR_CONSUMER_KEY',
secret: 'YOUR_CONSUMER_SECRET'
}
}
);Meetup
Setting up Meetup OAuth
Visit https://www.meetup.com/api/oauth/list/ and sign in
Click "Create new client"
Set the "Client name" to the name of your application
Set the "Application Website" to your site URL
Set the "Redirect URI" to your site URL (e.g.,
http://localhost:3000). Do not append a path to this URLFill out all the other required fields.
Click "Create" and note down your "Key" (Client ID) and "Secret" (Client Secret)
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"meetup": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'meetup' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);Weibo
Weibo is currently deprecated and the team is looking for maintainers for this package.
Setting up Weibo OAuth
Visit https://open.weibo.com/apps and sign in (Google Chrome's automatic translation works well here)
Click "创建应用" (Create Application) and select "网页应用" (Web Application)
Complete the registration form with your app details
Complete the email verification process
In your app dashboard, go to "应用信息" > "高级信息" (Application Info > Advanced Information)
Set "OAuth2.0 授权回调页" (OAuth2.0 Redirect URI) to
YOUR_SITE_URL/_oauth/weibo(e.g.,http://localhost:3000/_oauth/weibo)In "应用信息" > "基本信息" (Application Info > Basic Information), note down your "App Key" (Client ID) and "App Secret" (Client Secret)
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"weibo": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'weibo' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);Meteor Developer Accounts
Setting up Meteor Developer OAuth
Visit https://beta.galaxycloud.app/ and sign in
Go to Settings -> Authorized Domains and Add New Domain
Set the "OAuth Redirect URL" to
YOUR_SITE_URL/_oauth/meteor-developer(e.g.,http://localhost:3000/_oauth/meteor-developer)Click "Create" and note down your "Client ID" and "Client Secret"
Configuration
Add to your settings.json:
{
"packages": {
"service-configuration": {
"meteor-developer": {
"clientId": "YOUR_CLIENT_ID",
"secret": "YOUR_CLIENT_SECRET"
}
}
}
}Or configure programmatically:
import { ServiceConfiguration } from 'meteor/service-configuration';
await ServiceConfiguration.configurations.upsertAsync(
{ service: 'meteor-developer' },
{
$set: {
clientId: 'YOUR_CLIENT_ID',
secret: 'YOUR_CLIENT_SECRET'
}
}
);Community services
You can add settings for community OAuth providers in the same manner as above. Just check with their documentation for the naming of the keys and any other exceptional behavior. If those providers have *-config-ui you can find the instructions there.

