From 034bd4e6d107f5a48f560327cc2800cb41995f13 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Fri, 31 Aug 2018 05:57:59 -0400 Subject: Add a helper for completing authentication via the command line --- examples/register.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/register.rs b/examples/register.rs index 7b581ee..d6a2275 100644 --- a/examples/register.rs +++ b/examples/register.rs @@ -6,6 +6,7 @@ pub use self::elefren::prelude::*; use std::{error::Error, io}; +use self::elefren::helpers::cli; #[cfg(feature = "toml")] use self::elefren::helpers::toml; @@ -34,12 +35,7 @@ pub fn register() -> Result> { .scopes(Scopes::all()) .website("https://github.com/pwoolcoc/elefren") .build()?; - let url = registration.authorize_url()?; - - println!("Click this link to authorize on Mastodon: {}", url); - let code = read_line("Paste the returned authorization code: ")?; - - let mastodon = registration.complete(&code)?; + let mastodon = cli::authenticate(registration)?; // Save app data for using on the next run. toml::to_file(&*mastodon, "mastodon-data.toml")?; -- cgit v1.2.3