Browse Source

refactor: update auth apis

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
35f8328ae5
  1. 29
      packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts
  2. 18
      scripts/sdk/swagger.json

29
packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts

@ -442,5 +442,34 @@ const mapRoutes = router => {
ncMetaAclMw(passwordChange, 'passwordChange') ncMetaAclMw(passwordChange, 'passwordChange')
); );
router.post('/auth/token/refresh', ncMetaAclMw(refreshToken, 'refreshToken')); router.post('/auth/token/refresh', ncMetaAclMw(refreshToken, 'refreshToken'));
router.post('/api/v1/db/auth/user/signup', catchError(signup));
router.post('/api/v1/db/auth/user/signin', catchError(signin));
router.get(
'/api/v1/db/auth/user/me',
extractProjectIdAndAuthenticate,
catchError(me)
);
router.post('/api/v1/db/auth/password/forgot', catchError(passwordForgot));
router.post(
'/api/v1/db/auth/token/validate/:tokenId',
catchError(tokenValidate)
);
router.post(
'/api/v1/db/auth/password/reset/:tokenId',
catchError(passwordReset)
);
router.post(
'/api/v1/db/auth/email/validate/:tokenId',
catchError(emailVerification)
);
router.post(
'/user/password/change',
ncMetaAclMw(passwordChange, 'passwordChange')
);
router.post(
'/api/v1/db/auth/token/refresh',
ncMetaAclMw(refreshToken, 'refreshToken')
);
}; };
export { mapRoutes as userApis }; export { mapRoutes as userApis };

18
scripts/sdk/swagger.json

@ -10,7 +10,7 @@
} }
], ],
"paths": { "paths": {
"/auth/user/signup": { "/api/v1/db/auth/user/signup": {
"post": { "post": {
"summary": "Signup", "summary": "Signup",
"operationId": "auth-signup", "operationId": "auth-signup",
@ -49,7 +49,7 @@
"description": "Create a new user with provided email and password and first user is marked as super admin. " "description": "Create a new user with provided email and password and first user is marked as super admin. "
} }
}, },
"/auth/user/signin": { "/api/v1/db/auth/user/signin": {
"post": { "post": {
"summary": "Signin", "summary": "Signin",
"operationId": "auth-signin", "operationId": "auth-signin",
@ -98,7 +98,7 @@
}, },
"parameters": [] "parameters": []
}, },
"/auth/user/me": { "/api/v1/db/auth/user/me": {
"parameters": [], "parameters": [],
"get": { "get": {
"summary": "User Info", "summary": "User Info",
@ -121,7 +121,7 @@
"description": "Returns authenticated user info" "description": "Returns authenticated user info"
} }
}, },
"/auth/password/forgot": { "/api/v1/db/auth/password/forgot": {
"post": { "post": {
"summary": "Password Forgot", "summary": "Password Forgot",
"operationId": "auth-password-forgot", "operationId": "auth-password-forgot",
@ -151,7 +151,7 @@
}, },
"parameters": [] "parameters": []
}, },
"/auth/password/change": { "/api/v1/db/auth/password/change": {
"post": { "post": {
"summary": "Password Change", "summary": "Password Change",
"operationId": "auth-password-change", "operationId": "auth-password-change",
@ -187,7 +187,7 @@
}, },
"parameters": [] "parameters": []
}, },
"/auth/token/validate/{token}": { "/api/v1/db/auth/token/validate/{token}": {
"post": { "post": {
"summary": "Reset Token Verify", "summary": "Reset Token Verify",
"operationId": "auth-password-reset-token-validate", "operationId": "auth-password-reset-token-validate",
@ -212,7 +212,7 @@
} }
] ]
}, },
"/auth/email/validate/{token}": { "/api/v1/db/auth/email/validate/{token}": {
"post": { "post": {
"summary": "Verify Email", "summary": "Verify Email",
"operationId": "auth-email-validate", "operationId": "auth-email-validate",
@ -237,7 +237,7 @@
} }
] ]
}, },
"/auth/password/reset/{token}": { "/api/v1/db/auth/password/reset/{token}": {
"post": { "post": {
"summary": "Password Reset", "summary": "Password Reset",
"operationId": "auth-password-reset", "operationId": "auth-password-reset",
@ -276,7 +276,7 @@
} }
] ]
}, },
"/auth/token/refresh": { "/api/v1/db/auth/token/refresh": {
"post": { "post": {
"summary": "Refresh Token", "summary": "Refresh Token",
"operationId": "auth-token-refresh", "operationId": "auth-token-refresh",

Loading…
Cancel
Save