Comments (6)
?
It shouldn't be: https://github.com/dermesser/yup-oauth2/blob/master/src/installed.rs#L197
from yup-oauth2.
Given this data (manifest, code, secret):
[package]
name = "google_test"
version = "0.1.0"
authors = ["Taryn Hill <[email protected]>"]
[dependencies]
yup-oauth2 = "1.0"
hyper = "0.10"
hyper-rustls = "0.6"
google-calendar3 = "1.0"
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as auth;
extern crate google_calendar3 as gcal;
use std::path::Path;
use hyper::net::HttpsConnector;
use auth::{Authenticator, FlowType, ApplicationSecret, DiskTokenStorage, DefaultAuthenticatorDelegate, read_application_secret};
use gcal::CalendarHub;
const CLIENT_SECRET_FILE: &'static str = "client_secret.json";
fn main() {
let secret = read_application_secret(Path::new(CLIENT_SECRET_FILE)).unwrap();
let client = hyper::Client::with_connector(HttpsConnector::new(hyper_rustls::TlsClient::new()));
let authenticator = Authenticator::new(&secret,
DefaultAuthenticatorDelegate,
client,
DiskTokenStorage::new(&"token_store.json".to_string()).unwrap(),
Some(FlowType::InstalledRedirect(5000)));
let client = hyper::Client::with_connector(HttpsConnector::new(hyper_rustls::TlsClient::new()));
let hub = CalendarHub::new(client, authenticator);
let (_resp, list_result) = hub.calendar_list().list().doit().unwrap();
for cal in list_result.items.unwrap_or(vec![]) {
println!("{} ({})",
cal.summary.unwrap_or("<no summary>".to_string()),
cal.id.unwrap_or("<no id>".to_string()));
}
}
{
"web": {
"client_id": "1047850706592-d7ljgqu55ot9usc0kc8t2ihbueqrskta.apps.googleusercontent.com",
"project_id": "calendar-api-test-171020",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "<my secret>",
"redirect_uris": [
"http://localhost"
]
}
}
I get:
Please direct your browser to https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/calendar.readonly&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=1047850706592-d7ljgqu55ot9usc0kc8t2ihbueqrskta.apps.googleusercontent.com, follow the instructions and enter the code displayed here:
from yup-oauth2.
Perhaps this library wants me to use a service account but according to https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps a service account is not what I want.
I want to make requests on behalf of the user without them having to directly interact with my application on a regular basis (just allow auth and of course revoke auth if they decide to, but that is done via Google's interfaces as far as the user is concerned).
from yup-oauth2.
Calendar doesn't want a service account, and even if it would -- that would return an error, not present this.
One explanation would be that the HTTP server fails to start, so that the InstalledFlow falls back to the interactive flow: https://github.com/dermesser/yup-oauth2/blob/master/src/installed.rs#L100. Is there by any chance anything else listening on port 5000? (a UPnP service, for example)
from yup-oauth2.
The only thing listening on port 5000 is a flask app I threw together to get the redirect auth code from Google.
from yup-oauth2.
You don't need that server. yup-oauth2 starts its own HTTP server to catch the code. And in this case it can't, because there's already your server listening on the port it wants to listen on.
from yup-oauth2.
Related Issues (20)
- Accept custom connectors HOT 2
- The DefaultHyperClient does not support http - Issue with metadata server authentication HOT 1
- Is there a way to stub authenticators? HOT 3
- Service account impersonation HOT 2
- Can we make the structs JSONToken & JSONTokens Public? HOT 2
- Custom redirect URI HOT 10
- [Question] - Get the signin link (custom message) HOT 1
- API improvements for Flows HOT 3
- HttpError occur during get token HOT 2
- Support for workload identity federation HOT 3
- PKCE
- Support for login_hint parameter
- Providing a RefreshToken for the AccessTokenAuthenticator HOT 1
- redirect_url to return String not &str HOT 4
- Method to retrieve the OAuth URL or opening the URL in the browser using the `open` crate HOT 1
- ADC Service Impersonation missing client_id HOT 4
- Upgrade to Hyper 1 HOT 2
- Is it possible to use static API key for simple usage HOT 1
- Latest release 10.0.0 does not compile HOT 2
- rustls panics when initializing DefaultConnection HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yup-oauth2.