added refresh workflow

This commit is contained in:
Nicolas Constant 2019-10-01 23:05:52 -04:00
parent 58414baa8e
commit c56ae31964
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,20 @@ export class AuthService {
return this.httpClient.post<TokenData>(url, bodyLoad).toPromise();
}
refreshToken(instance: string, client_id: string, client_secret: string, refresh_token: string): Promise<TokenData> {
const url = `https://${instance}/oauth/token?client_id=${client_id}&client_secret=${client_secret}&grant_type=refresh_token&refresh_token=${refresh_token}&scope=${encodeURIComponent('read write follow')}`;
const bodyLoad = {
'client_id': client_id,
'client_secret': client_secret,
'grant_type': 'refresh_token',
'refresh_token': refresh_token,
'scope': 'read write follow'
};
return this.httpClient.post<TokenData>(url, bodyLoad).toPromise();
}
createNewApplication(instance: string, appName: string, redirectUrl: string, scopes: string, website: string): Promise<AppData> {
const url = 'https://' + instance + this.apiRoutes.createApp;