Skip to content

Commit

Permalink
redirect_uri=localhost instead of 127.0.0.1
Browse files Browse the repository at this point in the history
Facebook GraphAPI doesn't support 127.0.0.1 as redirect_uri
  • Loading branch information
JaderDias committed Jun 16, 2024
1 parent a1ec8d0 commit 4e5547a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/installed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tokio::io::{AsyncRead, AsyncWrite};
use tokio::sync::oneshot;
use tower_service::Service;
use url::form_urlencoded;
use url::quirks::port;

const QUERY_SET: AsciiSet = CONTROLS.add(b' ').add(b'"').add(b'#').add(b'<').add(b'>');

Expand Down Expand Up @@ -204,7 +205,7 @@ impl InstalledFlow {
// by certain providers.
let redirect_uri: Cow<str> = match self.flow_delegate.redirect_uri() {
Some(uri) => uri.into(),
None => format!("http://{}", server_addr).into(),
None => format!("http://localhost:{}", server_addr.port()).into(),
};
let url = build_authentication_request_url(
&app_secret.auth_uri,
Expand Down Expand Up @@ -255,7 +256,7 @@ impl InstalledFlow {
use std::borrow::Cow;
let redirect_uri: Cow<str> = match (custom_redirect_uri, server_addr) {
(Some(uri), _) => uri.into(),
(None, Some(addr)) => format!("http://{}", addr).into(),
(None, Some(addr)) => format!("http://localhost:{}", addr.port()).into(),
(None, None) => OOB_REDIRECT_URI.into(),
};

Expand Down

0 comments on commit 4e5547a

Please sign in to comment.