Comments (11)
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.
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.
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.
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.
Can you at least format your code block please @philsturgeon :-)
from phpoauthlib.
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.
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.
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.
Putting on hold for now, we will implement this as part of a separate (but integrated) package later.
from phpoauthlib.
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.
@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)
- Suggested method to authenticate against sandbox / test environment? HOT 1
- New authorization method coming to BattleNet
- Etsy Connection Error
- Amazon access token problem and fix
- LinkedIn v2 support HOT 2
- Etsy API OAuth Issues while reload page after getting responce
- what about nextcloud
- Discord and Steam Support? HOT 2
- No stable release on packagist since 2018 HOT 4
- Wrong version on composer require HOT 1
- Support to upload Flickr Images
- Update examples for new version
- New version release with PHP8 HOT 11
- Any plans for OIDC support?
- Serialising a token not including all values
- Request support HMAC-SHA256 HOT 4
- Many provider examples are not working HOT 1
- Any plans for Gitea support? HOT 1
- Add support for php 8.1? HOT 3
- Can't sign URL with array parameters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpoauthlib.