Переглянути джерело

[api] Simplify path api/iam/token to api/token

Romain Rigaux 4 роки тому
батько
коміт
db9a2925a8

+ 1 - 1
desktop/core/src/desktop/js/api/auth.ts

@@ -16,7 +16,7 @@
 
 
 import { post } from 'api/utils';
 import { post } from 'api/utils';
 
 
-const JWT_URL = 'api/iam/token/auth/';
+const JWT_URL = 'api/token/auth/';
 
 
 export const login = async (username: string, email: string, password: string): Promise<void> => {
 export const login = async (username: string, email: string, password: string): Promise<void> => {
   if (email !== '') {
   if (email !== '') {

+ 3 - 3
desktop/core/src/desktop/urls.py

@@ -208,9 +208,9 @@ dynamic_patterns += [
 ]
 ]
 
 
 dynamic_patterns += [
 dynamic_patterns += [
-  re_path('api/iam/token/refresh/?$', TokenRefreshView.as_view(), name='token_refresh'),
-  re_path('api/iam/token/verify/?$', TokenVerifyView.as_view(), name='token_verify'),
-  re_path('api/iam/token/auth/?$', TokenObtainPairView.as_view(), name='token_obtain_pair'),
+  re_path('api/token/refresh/?$', TokenRefreshView.as_view(), name='token_refresh'),
+  re_path('api/token/verify/?$', TokenVerifyView.as_view(), name='token_verify'),
+  re_path('api/token/auth/?$', TokenObtainPairView.as_view(), name='token_obtain_pair'),
 
 
   re_path(r'^api/', include('desktop.api_public_urls')),
   re_path(r'^api/', include('desktop.api_public_urls')),
 ]
 ]

+ 3 - 3
docs/docs-site/content/developer/api/rest/_index.md

@@ -76,11 +76,11 @@ In the meantime, with Axios:
       const API_URL = "/";
       const API_URL = "/";
       axios.defaults.baseURL = API_URL;
       axios.defaults.baseURL = API_URL;
 
 
-      axios.post('api/iam/token/auth/', {username: "hue", password: "hue"}).then(function(data) {
+      axios.post('api/token/auth/', {username: "hue", password: "hue"}).then(function(data) {
         console.log(data['data']);
         console.log(data['data']);
 
 
         // Util to check if cached token is still valid before asking to auth for a new one
         // Util to check if cached token is still valid before asking to auth for a new one
-        axios.post('api/iam/token/verify/', {token: data['access']});
+        axios.post('api/token/verify/', {token: data['access']});
 
 
         axios.defaults.headers.common['Authorization'] = 'Bearer ' + data['access'];
         axios.defaults.headers.common['Authorization'] = 'Bearer ' + data['access'];
       }).then(function() {
       }).then(function() {
@@ -110,7 +110,7 @@ It is possible to submit data in **JSON format**:
 
 
     -H "Content-Type: application/json" -d '{"username": "hue", "password": "hue"}'
     -H "Content-Type: application/json" -d '{"username": "hue", "password": "hue"}'
 
 
-### Login
+### Authentication
 
 
 Authenticating and getting a [JWT token](https://jwt.io/):
 Authenticating and getting a [JWT token](https://jwt.io/):