aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/auth
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-28 14:49:03 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit4a8d113b9b57d97ff13ad1608798eabca99643e4 (patch)
tree7c6e1ba86bff31680ba6c8ba4bd903b997592269 /client/src/app/core/auth
parent98813e69bccc568eff771cfcaf907ccdd82ce3f1 (diff)
downloadPeerTube-4a8d113b9b57d97ff13ad1608798eabca99643e4.tar.gz
PeerTube-4a8d113b9b57d97ff13ad1608798eabca99643e4.tar.zst
PeerTube-4a8d113b9b57d97ff13ad1608798eabca99643e4.zip
Begin support for external auths
Diffstat (limited to 'client/src/app/core/auth')
-rw-r--r--client/src/app/core/auth/auth.service.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 9ae008e39..61d755ba0 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -145,7 +145,7 @@ export class AuthService {
145 return !!this.getAccessToken() 145 return !!this.getAccessToken()
146 } 146 }
147 147
148 login (username: string, password: string) { 148 login (username: string, password: string, token?: string) {
149 // Form url encoded 149 // Form url encoded
150 const body = { 150 const body = {
151 client_id: this.clientId, 151 client_id: this.clientId,
@@ -157,6 +157,8 @@ export class AuthService {
157 password 157 password
158 } 158 }
159 159
160 if (token) Object.assign(body, { externalAuthToken: token })
161
160 const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') 162 const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
161 return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, objectToUrlEncoded(body), { headers }) 163 return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, objectToUrlEncoded(body), { headers })
162 .pipe( 164 .pipe(