examples/config.ru in reshape-0.1 vs examples/config.ru in reshape-0.1.1
- old
+ new
@@ -2,12 +2,12 @@
require 'sinatra/base'
require 'omniauth-shapeways'
require 'reshape'
# Get these keys from http://developer.shapeways.com
-ENV['CONSUMER_KEY'] = '61b13483fc0caf31f986026ce2add918d3fa9377'
-ENV['CONSUMER_SECRET'] = 'd0482b1653e67cfd25057c257eedd48a5cb8b66e'
+ENV['SHAPEWAYS_CONSUMER_KEY'] = ''
+ENV['SHAPEWAYS_CONSUMER_SECRET'] = ''
# To run this example:
# $ bundle install
# $ rackup -p 9293 config.ru &
@@ -16,16 +16,23 @@
redirect '/auth/shapeways'
end
get '/auth/:provider/callback' do
auth = request.env['omniauth.auth']
+
+ puts '::::'
+ puts auth.credentials.token
+ puts auth.credentials.secret
+
client = Reshape::Client.new({
- consumer_token: ENV['SHAPEWAYS_CONSUMER_TOKEN'],
+ consumer_token: ENV['SHAPEWAYS_CONSUMER_KEY'],
consumer_secret: ENV['SHAPEWAYS_CONSUMER_SECRET'],
oauth_token: auth.credentials.token,
- oauth_secret: auth.credentials.secret
+ oauth_secret: auth.credentials.secret,
+ proxy: 'http://localhost:8888'
})
+
materials = client.materials
erb "<h1>#{params[:provider]}</h1>
<pre>#{JSON.pretty_generate(auth)}</pre>
<pre>#{JSON.pretty_generate(materials)}</pre>"
@@ -37,9 +44,9 @@
end
use Rack::Session::Cookie
use OmniAuth::Builder do
- provider :shapeways, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET']
+ provider :shapeways, ENV['SHAPEWAYS_CONSUMER_KEY'], ENV['SHAPEWAYS_CONSUMER_SECRET']
end
run App.new
\ No newline at end of file