feat: with return url
Some checks are pending
ci/woodpecker/pr/test Pipeline is pending

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-11-21 22:52:22 +01:00
parent 9510b8fc42
commit 92e435e080
7 changed files with 86 additions and 37 deletions

View File

@@ -45,7 +45,7 @@ async fn main() -> anyhow::Result<()> {
conn: Some("postgres://nefarious-test:somenotverysecurepassword@localhost:5432/nefarious-test".into()),
},
},
config: ConfigClap { return_url: "http://localhost:3001".into() } // this normally has /authed
config: ConfigClap { return_url: "http://localhost:3001/authed".into() } // this normally has /authed
};
let auth_service = AuthService::new(&auth).await?;
@@ -76,9 +76,9 @@ impl FromRef<AppState> for AuthService {
}
async fn login(State(auth_service): State<AuthService>) -> impl IntoResponse {
let url = auth_service.login(Some("/authed".into())).await.unwrap();
let (headers, url) = auth_service.login(Some("/authed".into())).await.unwrap();
Redirect::to(url.as_ref())
(headers, Redirect::to(url.as_ref()))
}
async fn unauthed() -> String {