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

Django app : Box backend redirection error #886

Open
Arnautt opened this issue Feb 16, 2024 · 0 comments
Open

Django app : Box backend redirection error #886

Arnautt opened this issue Feb 16, 2024 · 0 comments

Comments

@Arnautt
Copy link
Contributor

Arnautt commented Feb 16, 2024

Expected behaviour

When attempting to authenticate with the Box API, user encounter a "redirect_uri_error". The exepected URL of the redirection is /complete/box/.

Actual behaviour

The URL contains the redirect_state parameter while Box provider recognize the state parameter.

What are the steps to reproduce this issue?

  1. Create a Box application on the Box developer console
  2. In the settings of Django app, add : AUTHENTICATION_BACKENDS = ['social_core.backends.box.BoxOAuth2']
  3. Run the server

How to fix it ?

Set the REDIRECT_STATE parameter to False in the Box backend.

class BoxOAuth2(BaseOAuth2):
    """Box.net OAuth authentication backend"""

    name = "box"
    AUTHORIZATION_URL = "https://www.box.com/api/oauth2/authorize"
    ACCESS_TOKEN_METHOD = "POST"
    ACCESS_TOKEN_URL = "https://www.box.com/api/oauth2/token"
    REVOKE_TOKEN_URL = "https://www.box.com/api/oauth2/revoke"
    SCOPE_SEPARATOR = ","
    REDIRECT_STATE = False
    EXTRA_DATA = [
        ("refresh_token", "refresh_token", True),
        ("id", "id"),
        ("expires", "expires"),
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant