Shopify / shopify_theme

A console tool for interacting with Shopify Theme Assets.
http://shopify.github.io/shopify_theme
MIT License
645 stars 135 forks source link

Support for OAuth token authentication #150

Closed gavinballard closed 9 years ago

gavinballard commented 9 years ago

Aware that this project is in maintenance mode, but I just pushed something that came up in the TalkShopify slack to my fork of this repository: https://github.com/Shopify/shopify_theme/compare/master...gavinballard:add_oauth_token_support.

If this is OK to get merged let me know and I will update the PR with tests, README and CHANGELOG updates et cetera.

csaunders commented 9 years ago

You could just drop support for the username and password.

You can make authenticated API requests by using the Private Apps Password, so you could just use password. Maybe something like this:

def self.shopify
  token = config[:access_token] || config[:password]
  headers 'X-Shopify-Access-Token', token
  base_uri "https://#{config[:store]}"
  ShopifyTheme
end

I'm pretty sure that would be a reverse compatible change, and would reduce the codepaths we'd need to worry about.

I'd totally accept a pull request on this. Thanks for the work @gavinballard!