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

Password Settings not Supported #79 #86

Closed
wants to merge 7 commits into from

Conversation

hugosenari
Copy link

Fix #79
Add UserNamePassword again and expose API to plugin define own pass type.
Just because #85 will not solve problem when service only accept OAuth, SAML or any kind of login or define strange config types.

@bluss
Copy link
Member

bluss commented Mar 26, 2017

I prefer the other one. ExtendedSetting is in kupfer.core and can not be used by plugins.

I'd also prefer if plugins did not become too entangled with the Gtk interface. As an aside, the best interface for plugins is the “kupfer interface”, i.e. exposing leaves and actions as usual.

@hugosenari
Copy link
Author

I will see options to implement generic OAuth flow and expose as ExtendedSetting. :)

@hugosenari hugosenari closed this Mar 27, 2017
@hugosenari
Copy link
Author

I was thinking...
Even if we won't expose ExtendedSetting for plugin, this change is necessary for use of any ExtendedSetting subclass, instead of current code that only apply for UserNamePassword. :-D

@hugosenari hugosenari reopened this Mar 27, 2017
@hugosenari
Copy link
Author

Added OAuth1 to this branch.
I created a Twitter plugin and some twitter posts to test.

Please give some feedback, so I can try add OAuth2 or rethink entire solution. =-)

@khurshid-alam
Copy link

I would be wonderful to have oauth support in kupfer.

@hugosenari How do I enter my own credentials?

@hugosenari
Copy link
Author

What you mean as credentials?

If you talking about 'OAuth Token' as plugin user:
At plugin preferences:

  • Click on 'Set' (opens OAuth Preference Dialog);
  • Then in 'Request New Token' (this will open browser asking for auth...);
  • Copy & Paste received Token back to OAuth Preference Dialog;
  • Click "OK".

In theory we can setup a local http server (using SimpleHttpServer) and receive Token back without copy & paste, but is more code complexity to deal. :-/

If you need to know how to set Consumer Credentials:

from kupfer.plugin_support import PluginSettings, OAuth1, check_oauth_support
check_oauth_support()
__kupfer_settings__ = PluginSettings( 
    {
        "key" : "oauth",
        "label": _("Access Token"),
        "type": OAuth1,
        "value": OAuth1(
            plugin_id="CONSUMER_CREDENTIALS_GOES_HERE",
            plugin_secret="AND_HERE",
            url_access="https://api.twitter.com/oauth/access_token",
            url_auth="https://api.twitter.com/oauth/authorize",
            url_request="https://api.twitter.com/oauth/request_token",
            url_callback="https://hugosenari.github.io/Kupfer-Plugins/token.html"
        ),
    }
)

Now If what you need is create your own Credentials Config Type:
As plugin user you can't. ;-)
As plugin developer you can't (unofficial: extending OAth1 overriding ask_user).
As kupfer developer extend settings.ExtendedSetting (ie: simple, complex)

@khurshid-alam
Copy link

@hugosenari I see.

So if this gets merged as a plugin developer I can use any other services which uses oauth1. Right?

@hugosenari
Copy link
Author

@khurshid-alam yeah but only 3 legged OAuth 1.0a.
I would appreciate some feedback in this code (even without merge) to start something with OAuth 2.0.

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

Successfully merging this pull request may close these issues.

Password Settings not Supported
4 participants