Git Product home page Git Product logo

oauth2-assembla's Introduction

Assembla provider for League OAuth 2 Client

This package provides a simple Assembla provider for The PHP League OAuth2 Client.

## Usage

composer require rmasters/oauth2-assembla
$provider = new Assembla([
  'clientId' => getenv('ASSEMBLA_CLIENT_ID'),
  'clientSecret' => getenv('ASSEMBLA_CLIENT_SECRET'),
  'redirectUri' => getenv('ASSEMBLA_REDIRECT_URI'),
]);

// Send to Assembla for authorization
if (!isset($_GET['code'])) {
    header('Location: ' . $provider->getAuthorizationUrl());
    exit;
}

// Get an access token from an authorization code
$token = $provider->getAccessToken('authorization_code', ['code' => $_GET['code']]);
$_SESSION['assembla'] = $token;

// Get the authenticated user
$user = $provider->getResourceOwner($token);
assert($user instanceof AssemblaResourceOwner);
printf("Logged in as %s", $user->getName());

License

MIT Licensed

oauth2-assembla's People

Contributors

rmasters avatar

Watchers

 avatar James Cloos avatar

Forkers

pgroot91

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.