Skip to content

Instantly share code, notes, and snippets.

@crwang
crwang / node_oauth_token_request
Last active February 11, 2020 16:41
Node JS request to get an oauth token with grant_type of password (to our doorkeeper endpoint)
var default_headers, site_root = 'http://localhost:3000';
default_headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-us,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
// 'Connection': 'keep-alive',
'Cache-Control': 'max-age=0'