realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

Fix incorrect Facebook authentication on server documentation #333

Closed revolter closed 6 years ago

revolter commented 6 years ago

The current documentation has this sample code:

const RealmObjectServer = require('realm-object-server');
const path = require('path');

const server = new RealmObjectServer.BasicServer();
const facebookProvider = new FacebookAuthProvider()

server.start({
    dataPath: path.join(__dirname, '../data'),
    authProviders: [ facebookProvider ],
}).catch((err) => {
    console.error("There was an error starting your custom Realm Object Server", err);
});

while it needs to be:

import { BasicServer } from 'realm-object-server'
import { FacebookAuthProvider } from '../node_modules/realm-object-server/dist/auth/facebook/FacebookAuthProvider'
import * as path from 'path'

const server = new BasicServer()
const facebookProvider = new FacebookAuthProvider()

server.start({
    dataPath: path.join(__dirname, '../data'),
    authProviders: [facebookProvider],
}).catch((err) => {
    console.error(`Error starting Realm Object Server: ${err.message}`)
});
bmunkholm commented 6 years ago

Thanks for reporting that. We will get that fixed.

asjit commented 6 years ago

There is the same issue with the documentation for the Azure Auth too: Need to update to include :

import { AzureAuthProvider } from '../node_modules/realm-object-server/dist/auth/azure/AzureAuthProvider'

nirinchev commented 6 years ago

You should be able to do which seems cleaner to me:

import { auth } from 'realm-object-server';

const facebookProvider = new auth.FacebookAuthProvider()
mgeerling commented 6 years ago

Updated with @nirinchev 's code