login through OIDC now working with local JWT aund (test) user listing

This commit is contained in:
2019-04-04 16:06:05 +02:00
parent c0b53decc2
commit 5332940a5b
6 changed files with 117 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ export function saveSurveyResponse (surveyResponse: any) {
}
export function postNewSurvey (survey: any, jwt: any) {
return axios.post(`${API_URL}/surveys/`, survey, { headers: { Authorization: `Bearer: ${jwt}` } })
return axios.post(`${API_URL}/surveys/`, survey, { headers: { Authorization: `Bearer ${jwt}` } })
}
export function authenticate (userData: any) {
@@ -26,6 +26,21 @@ export function register (userData: any) {
return axios.post(`${API_URL}/auth/register`, userData)
}
// This function probably isn't really useful here, as a user must be redirected to the actual OIDC provider.
// -> So login involves user interaction through the frontend (and not just API calls).
export function oidc_login (redirection_url: any) {
return axios.get(`${API_URL}/auth/oidc`, redirection_url)
}
export function getFreshToken (refresh_token: any) {
return axios.get(`${API_URL}/auth/fresh`, refresh_token)
}
export function getProviders () {
return axios.get(`${API_URL}/auth/providers`)
}
}
export function fetchUsers (jwt: any) {
console.log("JWT: " + jwt);
return axios.get(`${API_URL}/v1/user`, { headers: { Authorization: `Bearer ${jwt}` } })
}