Greasy Fork is available in English.
使用 token 登录 claude
当前为
// ==UserScript==
// @name claudeTokenLogin
// @namespace https://fk.oeatv.com/
// @version 1.1.2
// @description 使用 token 登录 claude
// @author fk.oeatv.com
// @match https://claude.ai/*
// @grant none
// @license GNU GPLv3
// ==/UserScript==
(function() {
'use strict';
var tokenInput = document.createElement('input');
tokenInput.type = 'text';
tokenInput.placeholder = '请输入sessionKey';
tokenInput.style.marginRight = '10px';
var saveButton = document.createElement('button');
saveButton.innerText = '保存并应用';
var tokenDisplay = document.createElement('div');
tokenDisplay.style.marginTop = '10px';
tokenDisplay.style.wordBreak = 'break-all';
var container = document.createElement('div');
container.style.position = 'fixed';
container.style.top = '10px';
container.style.right = '10px';
container.style.zIndex = '9999';
container.style.backgroundColor = 'white';
container.style.padding = '10px';
container.style.borderRadius = '5px';
container.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.3)';
container.appendChild(tokenInput);
container.appendChild(saveButton);
container.appendChild(tokenDisplay);
document.body.appendChild(container);
saveButton.addEventListener('click', function() {
var token = tokenInput.value;
var domain = 'claude.ai';
var cookieValue = 'sessionKey=' + token + '; path=/; domain=' + domain;
document.cookie = cookieValue;
location.reload();
});
// 显示当前的sessionKey
var cookies = document.cookie.split('; ');
var currentToken = '';
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].split('=');
if (cookie[0] === 'sessionKey') {
currentToken = cookie[1];
break;
}
}
tokenDisplay.innerText = 'Current sessionKey: ' + currentToken;
})();