przekazanie do sekretów do env - test only
This commit is contained in:
@@ -2,12 +2,14 @@ from rest_framework import viewsets, permissions, authentication
|
||||
from rest_framework.response import Response
|
||||
from jobposting.models import JobListing, SkillLevels, CompanyLogo, Skill
|
||||
from core.models import MyUser, AnonymousUserData
|
||||
from rest_framework import status
|
||||
from rest_framework import status,
|
||||
from jobposting.permissions import ClientCredentialPermission
|
||||
from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope, OAuth2Authentication
|
||||
from .auth import OAuth2ClientCredentialAuthentication
|
||||
from rest_framework.views import APIView
|
||||
import requests
|
||||
from django.conf import settings
|
||||
|
||||
permissions.IsAuthenticated
|
||||
from jobposting.serializers import (
|
||||
JobListingSerializer,
|
||||
SkillLevelsSerializer,
|
||||
@@ -86,3 +88,15 @@ class SkillViewset(viewsets.ModelViewSet):
|
||||
queryset = Skill.objects.all()
|
||||
serializer_class = SkillSerializer
|
||||
required_scope = ['main']
|
||||
|
||||
class GetAuthTokenView(APIView):
|
||||
def post(self, request):
|
||||
client_id = settings.OAUTH_CLIENT_ID
|
||||
client_secret = settings.OAUTH_CLIENT_SECRET
|
||||
data = {
|
||||
'grant_type': 'client_credentials',
|
||||
'client_id': client_id,
|
||||
'client_secret': client_secret,
|
||||
}
|
||||
response = requests.post('http://izaac.izaac.pl/token', data=data)
|
||||
return Response(response.json())
|
||||
Reference in New Issue
Block a user