Skip to content

Instantly share code, notes, and snippets.

@whisher
Created May 31, 2018 13:11
Show Gist options
  • Save whisher/8711a59ce1f901f81cfcec0c3dbd8f2c to your computer and use it in GitHub Desktop.
Save whisher/8711a59ce1f901f81cfcec0c3dbd8f2c to your computer and use it in GitHub Desktop.
const data = 'username=' + encodeURIComponent(credentials.username) + '&password=' +
encodeURIComponent(credentials.password) + '&grant_type=password&scope=read%20write&' +
'client_secret=' + this.clientSecret + '&client_id=' + this.clientId;
const headers = new HttpHeaders()
.set('Content-Type', 'application/x-www-form-urlencoded')
.set('Accept', 'application/json')
.set('Authorization', 'Basic ' + this.base64('myapp' + ':' + 'mySecretOAuthSecret'));
return this.http.post(this.urlLogin, data, {
headers
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment