mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-03-25 08:55:49 +00:00
added full auth flow example
This commit is contained in:
parent
b2c0d13f01
commit
95b6be116b
1 changed files with 16 additions and 0 deletions
16
examples/authorization_flow.rb
Normal file
16
examples/authorization_flow.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require 'instapaper'
|
||||
|
||||
credentials = {
|
||||
consumer_key: 'CONSUMER_KEY',
|
||||
consumer_secret: 'CONSUMER_SECRET',
|
||||
}
|
||||
|
||||
client = Instapaper::Client.new(credentials)
|
||||
token = client.access_token('username', 'password')
|
||||
# => #<Instapaper::Credentials oauth_token="710c838347ae178b4a92c6912e7e72e16c7e42f2" oauth_token_secret="XSXuU7TxBCzbKLjHH4R5iv8wfESLjeY9DI9sAdRBmCnui1E64m">
|
||||
|
||||
client.oauth_token = token.oauth_token
|
||||
client.oauth_token_secret = token.oauth_token_secret
|
||||
|
||||
client.verify_credentials
|
||||
# => #<Instapaper::User username="username" user_id=123456 type="user" subscription_is_active=false>
|
||||
Loading…
Reference in a new issue