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

Add provider for OpenStreetMap, using OAuth 1.0a #869

Merged
merged 4 commits into from
Nov 3, 2017

Conversation

jocelynj
Copy link
Contributor

@jocelynj jocelynj commented Oct 22, 2017

Summary

  • New provider

Goal

Addition of OpenStreetMap authentication against v2 branch

Description

I've added OpenStreetMap authentication on wordpress plugin, and thought it would be better to add it on hybridauth git repository instead of wordpress-social-login. I've only tested the plugin through Wordpress.

@StorytellerCZ StorytellerCZ added this to the 2.x milestone Oct 23, 2017
@StorytellerCZ
Copy link
Contributor

Thank you! Can I ask you to also provide basic documentation?

@jocelynj
Copy link
Contributor Author

jocelynj commented Oct 23, 2017 via email

Copy link
Member

@ApacheEx ApacheEx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some issues which should be fixed before merging 👍
Thank you for your effort. 🌞

function getUserProfile()
{
try{
$apiUrl = 'https://api.openstreetmap.org/api/0.6/user/details';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be just 'user/details' because $this->api->api_base_url will be added automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true - I've add several issue when making this provider, so I tried several things. The real fix was in fact to switch to a XML decoder instead of using json (which seems to be the default decoding)

/**
* Hybrid_Providers_OpenStreetMap (openstreetmap.org)
*/
class Hybrid_Providers_OpenStreetMap extends Hybrid_Provider_Model_OAuth1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no coding standards at all. Can you fix it according to PSR2 standard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've fixed indentation, and functions calls

return $this->user->profile;
}

function httpRequest( $url )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not used at all. Please remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this unused function httpRequest().


$response = @ new SimpleXMLElement( $response );

$this->user->profile->identifier = (string) $response->user["id"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's impossible to have object and array in one instance like here $response->user, so pls use only array style or only object-properties style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand what you mean ?

Should I replace $response->user["id"] by $response->user->id ?

@ApacheEx
Copy link
Member

ApacheEx commented Oct 23, 2017

@jocelynj
there is no guideline how to add documentation, but you can try to find how it's done with other providers in gh-pages branch.

@jocelynj
Copy link
Contributor Author

Do you have any example of unit tests for Providers ?

@StorytellerCZ
Copy link
Contributor

This is v2 so we can skip that part :(

@StorytellerCZ
Copy link
Contributor

@ApacheEx Looking good now?

Copy link
Member

@ApacheEx ApacheEx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, now it looks more clean and can be merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants