Hello.js Demo Twitter Error

1.5k Views Asked by At
hellojs twitter error

When i run the twitter demo from demo folder and clicked on twitter button it give me following error

url is undefind in hello.js file on this line if(url.indexOf(x)>-1){

how to fix this error

thanks

1

There are 1 best solutions below

0
On

When running the demo page in question

http://adodson.com/hello.js/demos/twitter.html

You'll see...

hello.init({
'twitter' : TWITTER_CLIENT_ID
},
{
redirect_uri:'../redirect.html',
oauth_proxy: OAUTH_PROXY_URL
});

The setup includes an OAUTH_PROXY_URL variable. This tells HelloJS the location of the server-side shim in order for this to work with OAuth1 authorisation providers like Twitter (unlike OAuth2 providers which can share authentication tokens purely client-side)

If running this from a local domain like //localhost this will have been an undefined value.

You'll need to do two things to get the demo working.

  1. Define the oauth_proxy option in the demo code. See http://auth-server.herokuapps.com for setting one up. OR remove it entirely and by default it will use the above service - you'll need to register third party apps there (recommended).
  2. Change your development environment in your host file to something other than //localhost, that way you can register OAuth2 providers which are domain sensitive and often wont let you use localhost when registering your apps callback URI. If you change your development environment to be local.knarly.com with hello.js project as a subfolder - then you can skip step 1 as the oauth_proxy will be defined correctly.