Skip to content

Commit

Permalink
fix: rename obo_acces_stoken to obo_access_token for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
remyvdwereld committed Dec 17, 2024
1 parent 1a014a3 commit 4e87c30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/apps/addresses/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def residents_by_bag_id(self, request, bag_id):
# nummeraanduiding_id should have been retrieved, so get BRP data
if address.nummeraanduiding_id:
try:
obo_acces_stoken = request.data.get("obo_acces_stoken")
obo_access_token = request.data.get("obo_access_token")
brp_data, status_code = get_brp_by_nummeraanduiding_id(
request, address.nummeraanduiding_id, obo_acces_stoken
request, address.nummeraanduiding_id, obo_access_token
)
serialized_residents = ResidentsSerializer(data=brp_data)
serialized_residents.is_valid(raise_exception=True)
Expand Down
12 changes: 6 additions & 6 deletions app/utils/api_queries_brp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
logger = logging.getLogger(__name__)


def get_brp_by_nummeraanduiding_id(request, nummeraanduiding_id, obo_acces_stoken):
def get_brp_by_nummeraanduiding_id(request, nummeraanduiding_id, obo_access_token):
"""Returns BRP data by bag_"""

queryParams = {
"verblijfplaats__identificatiecodenummeraanduiding": f"{nummeraanduiding_id}",
"inclusiefoverledenpersonen": "true",
"expand": "partners,ouders,kinderen",
}
return get_brp(queryParams, obo_acces_stoken)
return get_brp(queryParams, obo_access_token)


def get_brp_by_address(request, postal_code, number, suffix, suffix_letter):
Expand Down Expand Up @@ -44,10 +44,10 @@ def get_brp_by_address(request, postal_code, number, suffix, suffix_letter):


@retry(stop=stop_after_attempt(3))
def get_brp(queryParams, obo_acces_stoken):
def get_brp(queryParams, obo_access_token):
"""Returns BRP data"""
url = f"{settings.BRP_API_URL}"
brp_access_token = get_brp_access_token(obo_acces_stoken)
brp_access_token = get_brp_access_token(obo_access_token)
response = requests.get(
url,
params=queryParams,
Expand All @@ -63,13 +63,13 @@ def get_brp(queryParams, obo_acces_stoken):
return response.json(), response.status_code


def get_brp_access_token(obo_acces_stoken):
def get_brp_access_token(obo_access_token):
url = settings.OIDC_OP_TOKEN_ENDPOINT
payload = {
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
"client_id": settings.BRP_CLIENT_ID,
"client_secret": settings.BRP_CLIENT_SECRET,
"assertion": obo_acces_stoken,
"assertion": obo_access_token,
"scope": f"{settings.BRP_CLIENT_ID}/.default",
"requested_token_use": "on_behalf_of",
}
Expand Down

0 comments on commit 4e87c30

Please sign in to comment.