错误 -> 语法错误:JSON.parse 处的 JSON 输入意外结束<匿名>

问题描述

这是错误

SyntaxError: Unexpected end of JSON input at JSON.parse () at authorize (c:\Users\xxxx\server.js:21:30) 在主要 (c:\Users\xxxx\server.js:11:22) 在对象。 (c:\用户\xxxx\server.js:7:1)

    function authorize() {
        //Error occured at this line
        const credentials = JSON.parse(process.env.CLIENT_SECRET)
    }

.env 文件

    CLIENT_SECRET ={
        "installed": {
            "client_id": "xxxx","project_id": "xxxx","auth_uri": "https://accounts.google.com/o/oauth2/auth","token_uri": "https://oauth2.googleapis.com/token","auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs","client_secret": "xxxx","redirect_uris": [
                "urn:ietf:wg:oauth:2.0:oob","http://localhost"
            ]
        }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)