I'm trying to use this forum software written in Go that has a config file that requires the values you see in main.go below. I tried to use an empty string ""
for the oauth credentials to play around on my local machine but I got an error
json. json: cannot unmarshal string into Go value of type oauth.Credentials
So, even if I were to deploy it on a server, I thought I would have had to enter the credentials as a string, which would trigger the error there as well.
Assuming my api key and secret were like this
key= X482xYAFG1I2RKBYR
secret = 4929390593pqI4wNMljlj4N71oyOdlWCzyNKhv4BAd4QXLvW2LF
Taking into consideration the requirements from main.go
below, how would you enter the credentials in a config.json file like this
{
"TwitterOAuthCredentials":,
"CookieAuthKeyHexStr":"2ded82bb63514dbd6a0af42a25df235c",
"CookieEncrKeyHexStr":"4add93d1d6bb3489c9b3ab5448704068",
"AnalyticsCode":"",
"AwsAccess":"",
"AwsSecret":"",
"S3BackupBucket":"",
"S3BackupDir": ""
}
config requirements from main.go
config = struct {
TwitterOAuthCredentials *oauth.Credentials
CookieAuthKeyHexStr *string
CookieEncrKeyHexStr *string
AnalyticsCode *string
AwsAccess *string
AwsSecret *string
S3BackupBucket *string
S3BackupDir *string
}{
&oauthClient.Credentials,
nil, nil,
nil,
nil, nil,
nil, nil,
}
If you don't want to set it, leave it out entirely, and it will get set to the default value.
Otherwise, enter the json representation of an oauth.Credentials
, which is just a Token
and a Secret
string:
type Credentials struct {
Token string // Also known as consumer key or access token.
Secret string // Also known as consumer secret or access token secret.
}
In your config, the credentials would look like:
"TwitterOAuthCredentials": {
"Token": "oauthtoken",
"Secret": "oauthsecret"
},