mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Make angular client load dynamically the generated client id/secret
This commit is contained in:
parent
2693922352
commit
23a5a916db
3 changed files with 46 additions and 0 deletions
|
@ -11,12 +11,29 @@ export class AuthService {
|
|||
|
||||
private _loginChanged;
|
||||
private _baseLoginUrl = '/api/v1/users/token';
|
||||
private _baseClientUrl = '/api/v1/users/client';
|
||||
private _clientId = '56f055587305d40b21904240';
|
||||
private _clientSecret = 'megustalabanana';
|
||||
|
||||
constructor (private http: Http) {
|
||||
this._loginChanged = new Subject<AuthStatus>();
|
||||
this.loginChanged$ = this._loginChanged.asObservable();
|
||||
|
||||
// Fetch the client_id/client_secret
|
||||
// FIXME: save in local storage?
|
||||
this.http.get(this._baseClientUrl)
|
||||
.map(res => res.json())
|
||||
.catch(this.handleError)
|
||||
.subscribe(
|
||||
result => {
|
||||
this._clientId = result.client_id;
|
||||
this._clientSecret = result.client_secret;
|
||||
console.log('Client credentials loaded.');
|
||||
},
|
||||
error => {
|
||||
alert(error);
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
login(username: string, password: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue