Closed BWStearns closed 2 months ago
@BWStearns Thanks for reporting this issue, I successfully replicated the error you mentioned. I think the error is related to the loco version we use in the library, loco v0.3.2.
@yinho999 I put up a PR which at least addressed the issue enough to unblock me locally. If there's other things that should be done in support of that PR (like updating demo etc) then let me know and I'll take a crack at it.
I was too optimistic 😄 . When I added the controller module I started getting new type issues. Working on them now, will add them into the PR if I find a solution.
error[E0277]: the trait bound `fn(axum::extract::State<loco_rs::prelude::AppContext>, axum_session::session::Session<SessionNullPool>, axum::extract::Query<AuthParams>, OAuth2PrivateCookieJar, axum::Extension<OAuth2ClientStore>) -> impl std::future::Future<Output = std::result::Result<impl IntoResponse, loco_rs::Error>> {google_callback::<OAuth2UserProfile, _entities::users::Model, _entities::o_auth2_sessions::Model, SessionNullPool>}: Handler<_, _>` is not satisfied
--> src/controllers/oauth2.rs:37:17
|
37 | get(google_callback::<
| _____________---_^
| | |
| | required by a bound introduced by this call
38 | | OAuth2UserProfile,
39 | | users::Model,
40 | | o_auth2_sessions::Model,
41 | | SessionNullPool,
42 | | >),
| |_____________^ the trait `Handler<_, _>` is not implemented for fn item `fn(State<AppContext>, Session<SessionNullPool>, Query<AuthParams>, OAuth2PrivateCookieJar, Extension<OAuth2ClientStore>) -> ... {google_callback::<..., ..., ..., ...>}`
|
= help: the following other types implement trait `Handler<T, S>`:
<axum_extra::handler::or::Or<L, R, Lt, Rt, S> as Handler<(M, Lt, Rt), S>>
<axum_extra::handler::IntoHandler<H, T, S> as Handler<T, S>>
<Layered<L, H, T, S> as Handler<T, S>>
<MethodRouter<S> as Handler<(), S>>
note: required by a bound in `axum::routing::get`
--> /Users/brianstearns/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.7.5/src/routing/method_routing.rs:385:1
|
385 | top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in `get`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `SessionNullPool: axum_session::databases::database::DatabasePool` is not satisfied
--> src/controllers/oauth2.rs:37:13
|
37 | get(google_callback::<
| ^^^ the trait `axum_session::databases::database::DatabasePool` is not implemented for `SessionNullPool`
|
= help: the following other types implement trait `axum_session::databases::database::DatabasePool`:
axum_session::databases::postgres::SessionPgPool
axum_session::databases::any_db::SessionAnyPool
axum_session::databases::null::SessionNullPool
note: required by a bound in `google_callback`
--> /Users/brianstearns/loco-oauth2/src/controllers/oauth2.rs:166:8
|
162 | pub async fn google_callback<
| --------------- required by a bound in this function
...
166 | W: DatabasePool + Clone + Debug + Sync + Send + 'static,
| ^^^^^^^^^^^^ required by this bound in `google_callback`
For more information about this error, try `rustc --explain E0277`.
I'm trying to use
loco-oauth2
with loco 0.6.0 and I'm running into an issue and having trouble diagnosing it. I am following the demo project closely and I have gone over my implementation pretty thoroughly.The oauth2 traits don't seem to like the async_trait macro. This is the case for both
and
I get an error like the following.
I don't see why there's a conflict between
loco_rs::model::ModelError
andloco_rs::prelude::ModelError
. My imports ino_auth2_sessions
look like this:Do you think there's something in the changes from loco 0.4.0 and 0.6.0 that is causing this type error? I am struggling to parse that "match the trait" suggestion from the compiler into an actionable plan.