Giter Club home page Giter Club logo

lein-paprika's People

Contributors

jeremyheiler avatar

Watchers

 avatar  avatar

lein-paprika's Issues

Cache multiple tokens

It should be possible to cache multiple tokens. The reason for this is because you could use Leiningen profiles to manage different accounts, or identical accounts with different scopes. In order to do this there needs to be a way to differentiate between the cached tokens, and determining which token is appropriate for the current session.

Cache invalidation should only operate on the token for the specific set of credentials being used. All other tokens should remain unaffected, except when there is a read error and the whole cache needs to be invalidated.

How should cached tokens be differentiated?

  • Profile Name
    • I'm not sure how to obtain it once a profile has been merged into the project map.
    • Not unique enough for standalone usage of the plugin.
  • Username and Scopes
    • This would be nice, but the information is not available until the token is obtained.
  • Custom Key
    • As a last resort, the user could provide a custom key.
    • I would rather not do this because it adds more overhead.
  • Client ID
    • This is one of the parameters when authorizing with Client ID and Client Secret.
    • If authorizing with a token, this value can be obtain by invoking paprika.core/token.
    • You wouldn't be able to authorize multiple accounts against the same Client ID. Although, it could be possible for the user to also provide the username of the specific account they want to use. Who would be the default user? Perhaps the username should be required then? I hate to require an extra field just for caching.
{:client-id-a {:user-1 {:access-token "user-1-token"}}
              {:user-2 {:access-token "user-2-token"}}}

Invalidate cache when credentials are different

With issue #1 complete, the latest token fetched from App.net will be cached. However, once a token is cached it will be used regardless if you're using different credentials. There needs to be a way to invalidate the cache and obtain a new token if the credentials are different.

If there is an error reading the cache, then it's safe to assume the file was corrupted at some point. In this case the file should be deleted and a new token should be obtained with the provided credentials.

Be able to use any endpoint as a subcommand

Any endpoint in paprika.core should be executable as a subcommand.

lein paprika create-post :text "This is this post's text."

All the parameters will be bundled into a map and passed into the function. The token will be extracted from the map if it is provided by the command (ditto with client id and secret), otherwise it will be obtained by the usual methods.

Cache the token to prevent needless re-authentication

A token should be cached if it was obtained by authenticating the user. If the token was provided by the user, then it must not cache it. Any token that is provided by the user must take precedence over any cached token. Consideration must be taken into account with regard to using multiple profiles for multiple apps.

A cached token could live in the .paprika-token file from within a project, or in the ~/.lein/paprika-token file when not. A subcommand should be introduced to clear the cached token.

Should the entire user map be cached, or just the token?

Allow a token to be provided when launching a REPL

It should be possible to provide an access token if you already have one.

As a command line parameter:

lein paprika repl :token $TOKEN

As a key under :paprika in the project map:

{:paprika {:token $TOKEN}}

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.