How to create a new OAuth provider for authentication?

Hello!

I need help in supporting custom OAuth provider. I’m basing it on “google” and “accounts-google” packages to create my solution.

In my project I have these packages installed:

accounts-base
http
meteor-platform
oauth2
service-configuration

But when I tried to call OAuth.registerService() or Accounts.oauth.registerService() I get an undefined error for OAuth or oauth. So how come when I use accounts-google and I don’t get this error?

Should I start some where else?

Try using another oAuth provider (i.e. Twitter). Did you set up your own service in the database? See my reply to this similar post.

1 Like

Hi @areich thanks for your help!

I did registered my own service using ServiceConfiguration.configurations.upsert(). I’m also looking into twitter and accounts-twitter and it looks very similar to google’s.

my problem is at the very beginning when I use OAuth.registerService() or Accounts.oauth.registerService() :’(

I think you need to add the package OAuth too, not only the oauth2. I had the same problem and that solved it. In fact, I’m trying to do exactly the same, to support a custom OAuth provider.

at the end I created my own package, I copied google, accounts-google.js, google_server.js, google_client.js, package.js. then I modified package,js a little bit create a file for “global” variables (among those files) and replaced all hard coded URL for variables.

the key in in here was the proper order of files inclusion, I hope this helps

2 Likes

My company, Prime8Consulting, has a similar need. So we wrote a package that gives your app oauth2 server support. We just published the packages and a excited to get feedback. It lots of documentation and example applications that demonstrate how it works.

2 Likes