PandaWhisperer / meteor-accounts-reddit

Reddit OAuth2 login service for use with Meteor
MIT License
2 stars 0 forks source link

Error in OAuth Server: invalid_scope #4

Open Thimoteus opened 9 years ago

Thimoteus commented 9 years ago

I'm using accounts-ui and set up my client id and secret with it. When I go to log in, it says "log in completed" but on the server I get the following:

W20141205-21:40:25.605(1) (oauth_server.js:78) Unable to parse state from OAuth query: µw{²ŒGÛEñՐ
W20141205-21:40:25.624(1) (oauth_server.js:78) Unable to parse state from OAuth query: µw{²ŒGÛEñՐ
W20141205-21:40:25.635(1) (oauth_server.js:398) Error in OAuth Server: invalid_scope

The reddit OAuth2 documentation says "Ensure that the scope parameter is a comma-separated list of valid scopes" but I'm not sure what to do with this information.

Thimoteus commented 9 years ago

OK, I was able to fix this by adding

Accounts.ui.config({
  requestPermissions: {
    reddit: ['read'],
  },
});

but now I'm getting another error saying I need to provide a user agent.

PandaWhisperer commented 9 years ago

Thanks for your feedback. I've been pretty busy with other stuff and have not had time to hack on my Meteor stuff recently. In fact, this package was written for a pre-release version of Meteor, so I'm glad it would even work with 1.0.

If you have the bandwidth to track this issue down and fix it, I'd be happy to accept a pull request and give you credit for it.

mscherer82 commented 9 years ago

I got the same problem. The user agent can be added in the reddit-oauth.js in the getIdentity() Method. After adding I got another error:

W20150107-16:26:21.435(1) (oauth_server.js:78) Unable to parse state from OAuth query: {À+é4ç�Qè±Ä
W20150107-16:26:21.437(1) (oauth_server.js:398) Error in OAuth Server: Unexpected OAuth service reddit
I20150107-16:26:21.581(1)? Exception while invoking method 'login' Error: Unexpected OAuth service reddit
I20150107-16:26:21.581(1)?     at middleware (packages/oauth/oauth_server.js:165:1)
I20150107-16:26:21.581(1)?     at packages/oauth/oauth_server.js:146:1

This is fired in the oauth.js of the OAuth package in the middleware function.

var service = registeredServices[serviceName];                           

// Skip everything if there's no service set by the oauth middleware    
if (!service)                                                                         
  throw new Error("Unexpected OAuth service " + serviceName);

I don't know why the service isn't stored in the registeredServices array, because it seems that the OAuth.registerService function will be called correctly.

PandaWhisperer commented 8 years ago

Hey guys. Just updated this package for use with Meteor 1.2. Not sure if any of you are still using it, but if you could test it out, would love to hear your feedback. Thanks!

SimplyLinn commented 8 years ago

I fixed this issue in https://github.com/PandaWhisperer/meteor-reddit-oauth/pull/5 by adding a default scope 'read'.

(A whopping 6 character pull request! but it's my first, you gotta start somewhere.)

janzheng commented 7 years ago

for just using Reddit to login, seems like using 'identity' would be the most private scope (for just Oauth login)

SimplyLinn commented 7 years ago

Ah, you're right. I should have read the reddit documentation better 😞

Ah well I might add another PR at some point.