How to implement redirect login style in custom Oauth implementation

I’ve created an Oauth 2 accounts server meant to log-in to from Meteor, alongside GitHub, FaceBook, Twitter, etc. It works well using the popup login style, but breaks under redirect style.

It for some reason calls the Oauth redirect URL twice! The first time passing the users token and state in as it should, but for some reason I cannot understand Meteor then immediately redirects the user to the base redirect URL with no parameters. That is:
https://myservice/_oauth/service. The redirect page ends up hanging on a white page saying, Login completed, click here to close this window, which means Meteor is confused and has thrown up.

It must by my accounts server, since GitHub redirect works fine. It must be sending the wrong data, causing Meteor to misbehave.

Here is an example of the parameters it passes after a successful login:

Accounts server redirects the user to:

On the backend, state is decoded into: {"loginStyle":"redirect","credentialToken":"fwuLtqAtRlf_IlNhvOlXkKd_gLPfRSDdfyJQNVaBxUv","isCordova":false}

whereas in the GitHub flow, state is decoded into:{"loginStyle":"redirect","credentialToken":"S3BPOOQck394oZjMxOPyqOt-8SZ8NllKzy1pDzBSOhN","isCordova":false,"redirectUrl":"https://myclient/"}

and here is my request handling code:

OAuth.registerService('myservice', 2, null, function(query) {

var serviceData = {
  validated: true,
  id: 12345,
  username: 'TEST USERNAME',
  email: '',
  accessToken: 'asdfqwer1234'

return {
  serviceData: serviceData,
  options: {profile: {name: “SAMPLE NAME"}}

Anyone here encounter this? Thank you!

did you ever figure this out?