Help us understand the problem. What is going on with this article?

VRChatで自分をフレンドに追加する

この記事について

柊 釘葉さまのVRChatのステータスをTwitterに表示するスプリクトtwitter-vrc-statusの導入で、自分自身をフレンドに追加するという部分の解説です。

TL;DR

これをコピペして実行すればフレンドリクエストが届きます。
Pythonの導入が必要です。

AddFriendMyself.py
import json
import requests

API_BASE = "https://api.vrchat.cloud/api/1"

url = "{}/config".format(API_BASE)
response = requests.get(url)
apiKey = json.loads(response.text)["clientApiKey"]

from requests.auth import HTTPBasicAuth

USER     = "" #ここにVRChatのIDを入力
PASSWORD = "" #ここにパスワード

url = "{}/auth/user".format(API_BASE)
response = requests.get(url, 
                        params={"apiKey": apiKey},
                        auth=HTTPBasicAuth(USER, PASSWORD))
token = response.cookies["auth"]
uid = json.loads(response.text)["id"]


url = "{0}/user/{1}/friendRequest".format(API_BASE, uid)
requests.post(url, 
                        params={"apiKey": apiKey, "authToken": token})

ここでつまった

VRChat APIのIDをログイン時のIDだと勘違いしていて3日悩みました。

参考

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away