Git Product home page Git Product logo

testing-oauth's Introduction

Testing OAuth with CasperJs

This project is a proof of concept that uses OAuth.io and CasperJs to test the OAuth flow of Linkedin functionnaly, from the end-user point of vue.

Dependencies

For the project to work, you need to install PhantomJs and CasperJs.

PhantomJs

To install PhantomJs, just get the binary from the PhantomJs download page, and link it as phantomjs in your PATH.

CasperJs

To install CasperJs, just run the following command in your console (note that CasperJs is available through npm, but is not a Nodejs module).

$ npm install -g casperjs

Other dependencies

Before running the testsuite don't forget to run :

$ npm install

Configuration

To be able to use the testsuite, you must first configure everything. The default configuration is available in the config.js file. You can override the fields in that file by creating a config.local.js file, copying the default values and changing them.

OAuth.io public app key

The first field you must configure is the public key of the OAuth.io app you are going to use to test the OAuth flow.

This app must be configured in your key-managerto contain the provider Linkedin, with the right keys and set to use the client-side flow.

Once that is done, you can copy the app's public key in your config.local.jsfile :

module.exports = {
    ...
    app_key: 'your_app_key',
    ...
};

Linkedin account credentials

Then you need to add your linkedin credentials (or those of a test account) in your config.local.js :

module.exports = {
    ...
    linkedin_account: {
        login: 'the_account_email',
        password: 'the_account_password'
    },
    ...
};

Launching the test suite

Once everything's configured, all you have to do is to launch the testsuite by running the following command in the project's folder :

$ node index.js

Don't worry if it waits for several seconds, it needs to load pages and that can take some time.

If everything worked, you should see that in the consolegi :

Test file: ./caspersuite/index.coffee                                           
# Linkedin test suite
PASS Provider authentication form appearance
PASS OAuth token retrieval

You can pass the --verbose argument to get more info about what's going on :

$ node index.js --verbose

License

This example project is licensed under the Apache2 license.

testing-oauth's People

Contributors

william26 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.