1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

feat: enabled csrf tokens for web component

This commit is contained in:
Saad Jutt
2022-04-29 02:59:48 +05:00
parent 13403517a4
commit e462aebdc0
6 changed files with 176 additions and 13 deletions

View File

@@ -10,7 +10,15 @@ const getAuthCode = async (credentials: any) =>
axios.post('/SASjsApi/auth/authorize', credentials).then((res) => res.data)
const login = async (payload: { username: string; password: string }) =>
axios.post('/login', payload).then((res) => res.data)
axios
.get('/form')
.then((res1) =>
axios
.post('/login', payload, {
headers: { 'csrf-token': res1.data.csrfToken }
})
.then((res2) => res2.data)
)
const Login = ({ getCodeOnly }: any) => {
const location = useLocation()