diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-github-main.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-github-main.ts index 1cbc3e5a3..383497122 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-github-main.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-github-main.ts @@ -26,10 +26,14 @@ export class CheGithubMainImpl implements CheGithubMain { async $uploadPublicSshKey(publicKey: string): Promise { await this.fetchToken(); - await this.axiosInstance.post('https://api.github.com/user/keys?access_token=' + this.token, { - title: 'che-theia', - key: publicKey, - }); + await this.axiosInstance.post( + 'https://api.github.com/user/keys', + { + title: 'che-theia', + key: publicKey, + }, + { headers: { Authorization: `Bearer ${this.token}` } } + ); } async $getToken(): Promise { @@ -47,7 +51,9 @@ export class CheGithubMainImpl implements CheGithubMain { } private async getUser(): Promise { - const result = await this.axiosInstance.get('https://api.github.com/user?access_token=' + this.token); + const result = await this.axiosInstance.get('https://api.github.com/user', { + headers: { Authorization: `Bearer ${this.token}` }, + }); return result.data; }