diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 1815696d..e99e437d 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -31,6 +31,20 @@ export class AuthService { return this.httpClient.post(url, bodyLoad).toPromise(); } + refreshToken(instance: string, client_id: string, client_secret: string, refresh_token: string): Promise { + 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(url, bodyLoad).toPromise(); + } + createNewApplication(instance: string, appName: string, redirectUrl: string, scopes: string, website: string): Promise { const url = 'https://' + instance + this.apiRoutes.createApp;