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

ref: code is non-null #85871

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sentry/auth/providers/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def exchange_token(self, request: HttpRequest, helper, code):
def dispatch(self, request: HttpRequest, helper) -> HttpResponse:
error = request.GET.get("error")
state = request.GET.get("state")
code = request.GET.get("code")
code = request.GET["code"]

if error:
return helper.error(error)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/identity/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def dispatch(self, request: HttpRequest, pipeline: Pipeline) -> HttpResponseBase
).capture() as lifecycle:
error = request.GET.get("error")
state = request.GET.get("state")
code = request.GET.get("code")
code = request.GET["code"]

if error:
logger.info("identity.token-exchange-error", extra={"error": error})
Expand Down
7 changes: 1 addition & 6 deletions src/sentry/identity/vsts/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.http.request import HttpRequest

from sentry import http, options
from sentry.http import safe_urlopen, safe_urlread
from sentry.identity.oauth2 import OAuth2CallbackView, OAuth2LoginView, OAuth2Provider, record_event
from sentry.integrations.utils.metrics import IntegrationPipelineViewType
from sentry.pipeline.base import Pipeline
Expand Down Expand Up @@ -125,8 +126,6 @@ def build_identity(self, data):

class VSTSOAuth2CallbackView(OAuth2CallbackView):
def exchange_token(self, request: HttpRequest, pipeline: Pipeline, code: str) -> dict[str, str]:
from sentry.http import safe_urlopen, safe_urlread

with record_event(
IntegrationPipelineViewType.TOKEN_EXCHANGE, pipeline.provider.key
).capture():
Expand Down Expand Up @@ -242,10 +241,6 @@ def get_authorize_params(self, state, redirect_uri):

class VSTSNewOAuth2CallbackView(OAuth2CallbackView):
def exchange_token(self, request: HttpRequest, pipeline: Pipeline, code: str) -> dict[str, str]:
from urllib.parse import parse_qsl

from sentry.http import safe_urlopen, safe_urlread

with record_event(
IntegrationPipelineViewType.TOKEN_EXCHANGE, pipeline.provider.key
).capture():
Expand Down
Loading