Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (33 sloc) 1.4 KB
import oauth.signpost.*
import oauth.signpost.basic.*
import oauth.signpost.http.*
import oauth.signpost.signature.*
import oauth.signpost.exception.*
import zero.core.utils.URIUtils
//Consumer key & secret from are stored in zero.config
OAuthConsumer consumer = new DefaultOAuthConsumer(
OAuthProvider provider = new DefaultOAuthProvider(
println "<pre>"
println "Fetching consumer request tokens..."
def authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND)
zput("/user/consumer", consumer)
zput("/user/provider", provider)
zput("/user/authurl", authUrl)
println "Consumer object: " + consumer
println "Consumer token secret: " + consumer.tokenSecret
println "Consumer token: " + consumer.token
println ""
println "Go here in a new tab, authorise the app for your account, and copy the PIN: "
println "<a target='_new' href='${authUrl}'>${authUrl}</a>"
println ""
println "When you're done, come back to this tab, paste the PIN and submit:</pre>"
println '<form action="verify.groovy" method="get">'
println 'PIN: <input type="text" name="oauth_verifier" /><br />'
println '<input type="submit" value="Submit" />'
println '</form>'
println '</pre>'