<commit_before>var request = require('request')
var parseXMLString = require('xml2js').parseString

var _PlexAuth = require('./helpers/PlexAuth.js')
var PlexConnection = require('./helpers/PlexConnection.js')
var PlexServer = require('./helpers/PlexServer.js')
var PlexClient = require('./helpers/PlexClient.js')
var PlexAuth = new _PlexAuth()

export default {
  PLEX_LOGIN_TOKEN: ({ commit, dispatch }, token) => {
    return new Promise((resolve, reject) => {
      var options = PlexAuth.getApiOptions('https://plex.tv/users/sign_in.json', token, 5000, 'POST')
      request(options, (error, response, body) => {
        if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
          let data = JSON.parse(body)
          if (!data) {
            commit('PLEX_SET_VALUE', ['signedin', false])
            return reject(new Error('No response data from Plex'))
          }
          commit('PLEX_SET_VALUE', ['user', data.user])
          commit('PLEX_SET_VALUE', ['signedin', true])<commit_msg>Include correct CLIENTIDENTIFIER in login POST<commit_after>var request = require('request')
var parseXMLString = require('xml2js').parseString

var _PlexAuth = require('./helpers/PlexAuth.js')
var PlexConnection = require('./helpers/PlexConnection.js')
var PlexServer = require('./helpers/PlexServer.js')
var PlexClient = require('./helpers/PlexClient.js')
var PlexAuth = new _PlexAuth()

export default {
  PLEX_LOGIN_TOKEN: ({ commit, dispatch, rootState }, token) => {
    return new Promise((resolve, reject) => {
      var options = PlexAuth.getApiOptions('https://plex.tv/users/sign_in.json', token, 5000, 'POST')
      options.headers['X-Plex-Client-Identifier'] = rootState.settings.CLIENTIDENTIFIER
      request(options, (error, response, body) => {
        if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
          let data = JSON.parse(body)
          if (!data) {
            commit('PLEX_SET_VALUE', ['signedin', false])
            return reject(new Error('No response data from Plex'))
          }
          commit('PLEX_SET_VALUE', ['user', data.user])
          commit('PLEX_SET_VALUE', ['signedin', true])
{'fraction_non_alphanumeric': 0.15426997245179064, 'fraction_numerical': 0.010101010101010102, 'mean_word_length': 3.655982905982906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1765214', 'n_tokens_mistral': 672, 'n_tokens_neox': 652, 'n_words': 145}