Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFTwitterUtils.logInWithBlock is not working for me. #1701

Closed
ShawnBaek opened this issue May 4, 2016 · 4 comments
Closed

PFTwitterUtils.logInWithBlock is not working for me. #1701

ShawnBaek opened this issue May 4, 2016 · 4 comments

Comments

@ShawnBaek
Copy link

Hi, I'm trying to login with twitter.

I hosted Parse Server at AWS.

`index.js

oauth: {
twitter: {
consumer_key: "MyTwitterKey", // REQUIRED
consumer_secret: "MyTwitterSecret" // REQUIRED
},
facebook: {
appIds: "Facebook Appids"
}
}`

`@IBAction func twitterButtonTapped(sender: AnyObject) {

    PFTwitterUtils.logInWithBlock {
        (user: PFUser?, error: NSError?) -> Void in
        if let user = user {
            if user.isNew {
                // process user object
                print("User signed up and logged in with Twitter!")
                self.processTwitterUser()
            } else {
                // process user object
                 print("User logged in with Twitter!")
                self.processTwitterUser()
            }
        } else {
            print("Uh oh. The user cancelled the Twitter login.")
        }
    }

}`

Error message is here
{"code":1,"message":"Internal server error."} (Code: 1, Version: 1.13.0)

Here is my log..

parse-server-example running on port 8081. ESC[31merrorESC[39m: Uncaught internal server error. [TypeError: Cannot read pro perty 'consumer_key' of undefined] TypeError: Cannot read property 'consumer_key ' of undefined at new OAuth (/var/app/current/node_modules/parse-server/lib/authDataManager /OAuth1Client.js:7:30) at validateAuthData (/var/app/current/node_modules/parse-server/lib/authData Manager/twitter.js:9:16) at /var/app/current/node_modules/parse-server/lib/authDataManager/index.js:8 8:14 : at /var/app/current/node_modules/parse-server/lib/RestWrite.js:255:12 at Array.map (native) at RestWrite.handleAuthDataValidation (/var/app/current/node_modules/parse-server/lib/RestWrite.js:247:43) at RestWrite.handleAuthData (/var/app/current/node_modules/parse-server/lib/RestWrite.js:287:15) at RestWrite.validateAuthData (/var/app/current/node_modules/parse-server/lib/RestWrite.js:238:19) at /var/app/current/node_modules/parse-server/lib/RestWrite.js:83:18 at run (/var/app/current/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22) ESC[31merrorESC[39m: Uncaught internal server error. [TypeError: Cannot read property 'consumer_key' of undefined] TypeError: Cannot read property 'consumer_key' of undefined at new OAuth (/var/app/current/node_modules/parse-server/lib/authDataManager/OAuth1Client.js:7:30) at validateAuthData (/var/app/current/node_modules/parse-server/lib/authDataManager/twitter.js:9:16) : at /var/app/current/node_modules/parse-server/lib/authDataManager/index.js:88:14 at /var/app/current/node_modules/parse-server/lib/RestWrite.js:255:12 at Array.map (native) at RestWrite.handleAuthDataValidation (/var/app/current/node_modules/parse-server/lib/RestWrite.js:247:43) at RestWrite.handleAuthData (/var/app/current/node_modules/parse-server/lib/RestWrite.js:287:15) at RestWrite.validateAuthData (/var/app/current/node_modules/parse-server/lib/RestWrite.js:238:19) at /var/app/current/node_modules/parse-server/lib/RestWrite.js:83:18 at run (/var/app/current/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)

Why My Pase Server can't read consumer_key?

I'm using aws beanstalk. After edit my index.js I always uploaded via eb deploy.

Could you helping me?

@ShawnBaek
Copy link
Author

I also initialize PFTwitterUtils in AppDelegate.swift

   PFTwitterUtils.initializeWithConsumerKey("MyKey", consumerSecret: "MySecretKey")

But It is not working for me...

@andj207
Copy link

andj207 commented May 9, 2016

Hi @yoshiboarder
I'm trying with ParseServer (set up on my laptop) and have the same error like yours. I have set Twitter Consumer Key in Parse App Settings and init PFTwitterUtils with required information but the error is the same. How can I fix it? Thanks in advance!

@ShawnBaek
Copy link
Author

@andj207 Hi I solved this problem to set twitter's consumer_key and consumer_secret.

Try this steps.

  1. cd "yourParseServerDirectory"
  2. vim index.js or open index.js via your favorite text editor.
  3. write here.

var api = new ParseServer({

//Add here!
oauth: {
     twitter: {
       consumer_key: "your key", // REQUIRED
       consumer_secret: "your secret" // REQUIRED
     },
     facebook: {
       appIds: "your app ids"
     }
}

});

Good luck

@andj207
Copy link

andj207 commented May 9, 2016

You've saved my day. Thank you, @yoshiboarder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants