Skip to content

Instantly share code, notes, and snippets.

@rinormaloku
Last active December 26, 2020 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rinormaloku/928719c2e62b56e5a31a82cc1bf32cbb to your computer and use it in GitHub Desktop.
Save rinormaloku/928719c2e62b56e5a31a82cc1bf32cbb to your computer and use it in GitHub Desktop.
[Authenticating requests with Bearer Token] for the article series Intro to Istio https://rinormaloku.com/istio-an-introduction/
analyzeSentence() {
fetch('/sentiment', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${auth.getAccessToken()}` // Access Token
},
body: JSON.stringify({ sentence: this.textField.getValue() })
})
.then(response => response.json())
.then(data => this.setState(data));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment