Skip to content

Commit

Permalink
Don't hardcode token endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KiOui committed Oct 27, 2024
1 parent 964b301 commit b57f5a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion website/orders/api/v1/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django_filters.rest_framework import FilterSet, ModelChoiceFilter
from django.db import models

from orders.models import Shift, Order, Product, OrderVenue
from orders.models import Shift, Order, Product
from venues.models import Venue


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h1 class="mt-5">No player for this venue</h1>
}
}

get_oauth_token_with_client_credentials(this.client_id, this.client_secret)
get_oauth_token_with_client_credentials("{% url "oauth2_provider:token" %}", this.client_id, this.client_secret)
.then(data => {
this.oauth_token = data;
resolve(this.oauth_token.access_token);
Expand Down
4 changes: 2 additions & 2 deletions website/tosti/static/tosti/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ function formatPrice(priceToFormat) {
}).format(priceToFormat).trim();
}

function get_oauth_token_with_client_credentials(client_id, client_secret) {
function get_oauth_token_with_client_credentials(token_endpoint, client_id, client_secret) {
let credentials = client_id + ":" + client_secret;
let credentials_utf8 = strToUTF8Arr(credentials);
let credentials_base64 = base64EncArr(credentials_utf8);
return fetch(
"/oauth/token/",
token_endpoint,
{
method: 'POST',
headers: {
Expand Down

0 comments on commit b57f5a7

Please sign in to comment.