Skip to content

feat: allow passing the frontend_base_url to RagbitsAPI #942

@puzzle-solver

Description

@puzzle-solver

Feature description

Right now, we use RAGBITS_BASE_URL environment variable to specify the address to which redirect during OAuth flow. It would be more convenient to be able to omit the variable completely and use relative paths if possible or at least pass it via the __init__ of RagbitsAPI.

Motivation

Right now, the default is "http://localhost:8000", which messes up the OAuth flow when the app is deployed. Since we usually host the frontend and backend on the same domain, I would argue that by default that variable should be empty, and all the redirects relative.

Relevant method: _handle_oauth2_callback, for example:

 if not access_token:
                return RedirectResponse(
                    url=f"{self.frontend_base_url}/login?error=token_exchange_failed", status_code=302
                )

Here, I think, we can just use "/login?error=token_exchange_failed" as URL by default.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions