mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 23:59:17 +02:00
Use scoped tokens to load <audio> urls instead of JWT
This commit is contained in:
parent
ff73de81d0
commit
e331a87478
17 changed files with 265 additions and 39 deletions
|
@ -428,8 +428,17 @@ export default {
|
|||
// so authentication can be checked by the backend
|
||||
// because for audio files we cannot use the regular Authentication
|
||||
// header
|
||||
let param = "jwt"
|
||||
let value = this.$store.state.auth.token
|
||||
if (this.$store.state.auth.scopedTokens && this.$store.state.auth.scopedTokens.listen) {
|
||||
// used scoped tokens instead of JWT to reduce the attack surface if the token
|
||||
// is leaked
|
||||
param = "token"
|
||||
value = this.$store.state.auth.scopedTokens.listen
|
||||
}
|
||||
console.log('HELLO', param, value, this.$store.state.auth.scopedTokens)
|
||||
sources.forEach(e => {
|
||||
e.url = url.updateQueryString(e.url, 'jwt', this.$store.state.auth.token)
|
||||
e.url = url.updateQueryString(e.url, param, value)
|
||||
})
|
||||
}
|
||||
return sources
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue