Skip to content

Instantly share code, notes, and snippets.

@sebilasse
Created March 7, 2018 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebilasse/db6eaf82c42be4e9692c8b1623f8295b to your computer and use it in GitHub Desktop.
Save sebilasse/db6eaf82c42be4e9692c8b1623f8295b to your computer and use it in GitHub Desktop.
stackexchange OAuth switch
const _u = URL.parse(provider.url);
const hostSite = _u.host.replace(/[.]com/g, '').replace(/[.]stackexchange/g, '');
const params = {
url: 'https://api.stackexchange.com/2.2/me',
responseType: 'json',
oauth: oauth,
query: {
order: 'desc',
filter: 'withbody',
site: (hostSite === '') ? 'stackoverflow' : hostSite,
access_token: oauth.access_token,
key: provider.apiKey
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment