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

Provider Request: Reddit (code provided) #73

Open
oppenheimer opened this issue Jun 20, 2015 · 7 comments
Open

Provider Request: Reddit (code provided) #73

oppenheimer opened this issue Jun 20, 2015 · 7 comments

Comments

@oppenheimer
Copy link

It was a step or two above my skill level but I got it working:

https://gist.github.com/619dd0a6536e1333522a.git

@oppenheimer oppenheimer changed the title Provider Request: Reddit Provider Request: Reddit (code provided) Jun 25, 2015
@adamwathan
Copy link
Owner

Hey just wanted to let you know this didn't go unnoticed, but haven't had time yet to give it a full look! It's on my to do list though :) Thanks!

@rvanbaalen
Copy link

@adamwathan Your package looks exciting to use but it seems like you haven't had/made much time to maintain it lately.

Would you recommend using your package or is there a better/newer version available? I'd like to extend this package with Trello support.

@adamwathan
Copy link
Owner

@rvanbaalen I'm still using it myself but haven't had much stuff I've needed to do on it.

All of the providers have been split out into packages like this: https://github.com/adamwathan/socialnorm-facebook

I'd like to honestly collapse them all into one repo but setup a git subtree split deal to break them off into different packages as part of a build process so that it's easy for people to submit new providers to one repo, but just haven't gotten around to it :(

If you'd like to add Trello support, you can actually do it without changing this package. Just create a new provider in your own namespace and register it with the OAuthManager in a service provider and it'll become available 👍

If you happen to know anything about git subtree or feel like learning (https://makingsoftware.wordpress.com/2013/02/16/using-git-subtrees-for-repository-separation/) I would be happy to collaborate on making it easier to get new providers added to the ecosystem :)

@rvanbaalen
Copy link

Thanks for the fast reply! Sorry to hijack this topic though. Probably should start a new issue to discuss this. How exactly do I go about registering my own provider with your OAuthManager? Do you perhaps have an example somewhere?

@adamwathan
Copy link
Owner

@rvanbaalen it appears not! But it would look something like this if you base your Trello provider on the base OAuth2Provider:

// RobinsAwesomeServiceProvider.php

public function boot()
{
    $this->app['adamwathan.oauth']->registerProvider('trello', $this->app[TrelloProvider::class]);
}

public function register()
{
    $this->app->singleton(TrelloProvider::class, function ($app) {
        $config = $app['config']['eloquent-oauth.providers.trello'];
        $httpClient = new GuzzleHttp\Client;
        $request = new SocialNorm\Request($app['request']->all());
        return new TrelloProvider($config, $httpClient, $request);
    });
}

// TrelloProvider.php

class TrelloProvider extends SocialNorm\Providers\Auth2Provider
{
    // Implement abstract methods and stuff, see any of the other providers for
    // a good starting point.
}

@rvanbaalen
Copy link

Great! Thanks Ill keep you updated on the progress.

Trello is a bit funky woth their OAuth implementation so this will be quite the challenge.

By the way, do you use OAuth2 by default? Trello uses OAuth1 I believe.


This email was sent from my iPhone and therefore subject to typos and other inaccuracies.

On 2 okt. 2015, at 14:59, Adam Wathan [email protected] wrote:

@rvanbaalen it appears not! But it would look something like this if you base your Trello provider on the base OAuth2Provider:

// RobinsAwesomeServiceProvider.php

public function boot()
{
$this->app['adamwathan.oauth']->registerProvider('trello', $this->app[TrelloProvider::class]);
}

public function register()
{
$this->app->singleton(TrelloProvider::class, function ($app) {
$config = $app['config']['eloquent-oauth.providers.trello'];
$httpClient = new GuzzleHttp\Client;
$request = new SocialNorm\Request($app['request']->all());
$trelloProvider = new TrelloProvider($config, $httpClient, $request);
return
});
}

// TrelloProvider.php

class TrelloProvider extends SocialNorm\Providers\Auth2Provider
{
// Implement abstract methods and stuff, see any of the other providers for
// a good strating point
}

Reply to this email directly or view it on GitHub.

@adamwathan
Copy link
Owner

Ah, yeah everything in this package is OAuth 2. I have yet to try to implement an OAuth 1 provider, it might not be possible :(

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

3 participants