Giter Club home page Giter Club logo

Comments (11)

daviddesberg avatar daviddesberg commented on May 29, 2024

I'll think about it, but I think what I'd do is have getUniqueUserIdentifier() which guarantees a unique user identifier no matter the service, and maybe a getUserEmail().

from phpoauthlib.

benbender avatar benbender commented on May 29, 2024

I would like to +1 for this request. I've built a simple layer on top of the lib myself lately and my feeling is that many of the users of this lib will repeat the same. For those users it would be of great benefit to get at least a simple layer of abstraction to use in their implementation. An example for such a layer can be found here: https://github.com/hwi/HWIOAuthBundle/blob/master/OAuth/Response/PathUserResponse.php

from phpoauthlib.

bencorlett avatar bencorlett commented on May 29, 2024

Yeah I ended up writing my own layer for it yesterday. The package I'm working for needs a consistent API for getting basic user information.

Sent from my iPhone
Please excuse my brevity

On 26/03/2013, at 12:40 AM, Benjamin Bender [email protected] wrote:

I would like to +1 for this request. I've built a simple layer on top of the lib myself lately and my feeling is, that many of the users of this lib will repeat the same. For those users it would be of great benefit to get at least a simple layer of abstraction to use in their implementation. An example for such a layer can be found here: https://github.com/hwi/HWIOAuthBundle/blob/master/OAuth/Response/PathUserResponse.php


Reply to this email directly or view it on GitHub.

from phpoauthlib.

philsturgeon avatar philsturgeon commented on May 29, 2024

I did this myself, and I don't think its bad to do.

    interface NetworkUserInterface
    {
        /**
         * Fetch Active User
         * Grab "me" from the API
         *
         * @param string $accessToken OAuth Token or Access Token, same thing
         * @param string $secret OAuth Token Secret, or whatever you want to call it
         * @return bool
         */
        public function fetchActiveUser($accessToken, $secret = null);

        /**
         * Fetch User By Uid
         * Grab some other user, not "me" (if they are not private and whatever)
         *
         * @param int $accessToken OAuth Token or Access Token, same thing
         * @param string $access Token OAuth Token or Access Token, same thing
         * @param string $secret OAuth Token Secret, or whatever you want to call it
         * @return bool
         */
        public function fetchUserByUid($uid, $accessToken, $secret = null);
        public function getNetwork();
        public function getId();
        public function getName();
        public function getEmail();
        public function getPictureUrl();
        public function getCoverUrl();
        public function getLocation();
        public function getTimezone();
        public function getGender();
        public function getBirthday();
    }

It could be moved into the package I guess.

from phpoauthlib.

PeeHaa avatar PeeHaa commented on May 29, 2024

Can you at least format your code block please @philsturgeon :-)

from phpoauthlib.

philsturgeon avatar philsturgeon commented on May 29, 2024

Oops.

It actually wont let me edit that, which is bizarre.

    interface NetworkUserInterface
    {
        /**
         * Fetch Active User
         * Grab "me" from the API
         *
         * @param string $accessToken OAuth Token or Access Token, same thing
         * @param string $secret OAuth Token Secret, or whatever you want to call it
         * @return bool
         */
        public function fetchActiveUser($accessToken, $secret = null);

        /**
         * Fetch User By Uid
         * Grab some other user, not "me" (if they are not private and whatever)
         *
         * @param int $accessToken OAuth Token or Access Token, same thing
         * @param string $access Token OAuth Token or Access Token, same thing
         * @param string $secret OAuth Token Secret, or whatever you want to call it
         * @return bool
         */
        public function fetchUserByUid($uid, $accessToken, $secret = null);

        public function getNetwork();

        public function getId();

        public function getName();

        public function getEmail();

        public function getPictureUrl();

        public function getCoverUrl();

        public function getLocation();

        public function getTimezone();

        public function getGender();

        public function getBirthday();
    }

There you go.

from phpoauthlib.

benbender avatar benbender commented on May 29, 2024

just for reference: I implemented mine a bit after the the path-approach from HWIOBundle: https://github.com/hwi/HWIOAuthBundle/blob/master/OAuth/Response/PathUserResponse.php

from phpoauthlib.

PeeHaa avatar PeeHaa commented on May 29, 2024

I think I would much rather see this implemented as a separate repo. I can see the usefulness of this request, but if implemented separately users can make the choice whether they need the provided abstraction layer.

As I see it a new project with an abstraction (on top of PHPoAuthLib) to easily make requests to the different services will be nice.

Any thoughts?

from phpoauthlib.

daviddesberg avatar daviddesberg commented on May 29, 2024

Putting on hold for now, we will implement this as part of a separate (but integrated) package later.

from phpoauthlib.

thomaswelton avatar thomaswelton commented on May 29, 2024

Hey @lusitanian, sorry for dragging up an old thread. But I'm currently in the process of implementing this functionality into my Laravel component. Right now the UserInterface is only really going to have a getUniqueUserIdentifier() method which I'd need to support account login & linking. For now I'm fine with not having auto account creation for all providers.

Once I've finished would you be interested in taking a look. I'm half way through now and believe it could be easily integrated into the core.
Or as you you mentioned above, if I strip this out into a separate package I suppose you could add it you your composer.json as a "suggested" installation http://getcomposer.org/doc/04-schema.md#suggest
I feel like a lot of people who use PHPoAuthLib will end up duplicating efforts unless we make a recommendation or provide a solution.

from phpoauthlib.

daviddesberg avatar daviddesberg commented on May 29, 2024

@thomaswelton I'd still go with a suggest rather than integrating it into the core, but this is a common use-case so I see your point -- no need for mass duplication of effort. Ping me when you have something you want to show me and we can chat about our options. Most likely it'll be pointed at in the readme and in the composer.json file though.

from phpoauthlib.

Related Issues (20)

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.