Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servant with servant-auth and jwts disallows a route with '[WithStatus 302 Redirect] #1631

Open
silky opened this issue Nov 28, 2022 · 0 comments

Comments

@silky
Copy link

silky commented Nov 28, 2022

it looks like, because of how named-routes must be implemented, we get an overlapping instance warning if we have a custom route that also does a 302 redirect:

the error is:

    • Overlapping instances for Servant.Server.Internal.HasServer
                                  (Servant.Auth.Server.Internal.AddSetCookie.AddSetCookieApi
                                     (Servant.Auth.Server.Internal.AddSetCookie.AddSetCookieApi
                                        (UVerb 'GET '[HTML] '[WithStatus 302 Redirect])))
                                  '[Servant.Auth.Server.Internal.ConfigTypes.CookieSettings,
                                    Servant.Auth.Server.Internal.ConfigTypes.JWTSettings]
        arising from a use of ‘genericServeTWithContext’

my own code had a custom route like:

data PrivateRoutes mode = PrivateRoutes
  { thing :: mode :- "thing" :> UVerb 'GET '[HTML] '[WithStatus 302 Redirect] }

a hacky "fix" is just to remove this route; then it compiles

can prepare a full working repro a bit later, if it's useful

my app looks something like:

app :: Application
app = genericServeTWithContext id server ctx
  where
    key       = ...
    jwtConfig = defaultJWTSettings key
    ctx       = defaultCookieSettings :. jwtConfig :. EmptyContext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant