diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-18 11:02:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-22 09:17:20 +0200 |
commit | cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86 (patch) | |
tree | a8d9e219c893551f669a3de37ae0ee91a6c0f7cd /client/src/app/core | |
parent | b4e5942ca79b8f5702c80197ec40eab8fa053a24 (diff) | |
download | PeerTube-cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86.tar.gz PeerTube-cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86.tar.zst PeerTube-cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86.zip |
Fix peertube with google bot
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 4b388d7be..4213da20c 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -11,6 +11,7 @@ import { environment } from '../../../environments/environment' | |||
11 | import { RestExtractor } from '../../shared/rest' | 11 | import { RestExtractor } from '../../shared/rest' |
12 | import { AuthStatus } from './auth-status.model' | 12 | import { AuthStatus } from './auth-status.model' |
13 | import { AuthUser } from './auth-user.model' | 13 | import { AuthUser } from './auth-user.model' |
14 | import { objectToUrlEncoded } from '@app/shared/misc/utils' | ||
14 | 15 | ||
15 | interface UserLoginWithUsername extends UserLogin { | 16 | interface UserLoginWithUsername extends UserLogin { |
16 | access_token: string | 17 | access_token: string |
@@ -113,17 +114,18 @@ export class AuthService { | |||
113 | 114 | ||
114 | login (username: string, password: string) { | 115 | login (username: string, password: string) { |
115 | // Form url encoded | 116 | // Form url encoded |
116 | const body = new URLSearchParams() | 117 | const body = { |
117 | body.set('client_id', this.clientId) | 118 | client_id: this.clientId, |
118 | body.set('client_secret', this.clientSecret) | 119 | client_secret: this.clientSecret, |
119 | body.set('response_type', 'code') | 120 | response_type: 'code', |
120 | body.set('grant_type', 'password') | 121 | grant_type: 'password', |
121 | body.set('scope', 'upload') | 122 | scope: 'upload', |
122 | body.set('username', username) | 123 | username, |
123 | body.set('password', password) | 124 | password |
125 | } | ||
124 | 126 | ||
125 | const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') | 127 | const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') |
126 | return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, body.toString(), { headers }) | 128 | return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, objectToUrlEncoded(body), { headers }) |
127 | .pipe( | 129 | .pipe( |
128 | map(res => Object.assign(res, { username })), | 130 | map(res => Object.assign(res, { username })), |
129 | mergeMap(res => this.mergeUserInformation(res)), | 131 | mergeMap(res => this.mergeUserInformation(res)), |