Skip to content

Instantly share code, notes, and snippets.

@Aaron2963
Last active March 5, 2024 09:08
Show Gist options
  • Save Aaron2963/1654711b2c0686e4dd4b23723d3cc800 to your computer and use it in GitHub Desktop.
Save Aaron2963/1654711b2c0686e4dd4b23723d3cc800 to your computer and use it in GitHub Desktop.
SecretCodeSet: 與各應用服務串接使用之金鑰碼、設定值
{
"totp": {
"secret": "FDE393FE83ACAFEDAD3BC2931",
"timeOffset": -48392
},
"line": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
},
"lineNotify": {
"accessToken": "xxxxxxx...."
},
"facebook": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
},
"google": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
}
}
@Aaron2963
Copy link
Author

  1. totp.id, line.id, facebook.id 要存什麼?
  2. totp.timeOffset 的值應為整數,不用加引號
  3. facebook.secret 要存什麼?

@cody-ds
Copy link

cody-ds commented Mar 4, 2024

totp.id 如果是我們自己的就應該可以刪掉
timestamp如果是很長的整數呢? 也不用"" 嗎? 1970-01-01 到現在也是一個10位數的長整數了 (OK 跟allen確認過,不需要 "" )

@allen-fu-test
Copy link

{
"facebook": {
"id": "248652415597752",
"accessToken": "xxxxxxx...."
},
"google": {
"id": "107807511758741549898",
"accessToken": "xxxxxxx...."
}
}

@Aaron2963
Copy link
Author

timestamp如果是很長的整數呢? 也不用"" 嗎? 1970-01-01 到現在也是一個10位數的長整數了

totp.timeOffset 應該只存時間差而已,不會存到確切的時間點,且考慮到可能是負數的情況,用字串存在後續的操作上可能容易混淆

@Aaron2963
Copy link
Author

{ "facebook": { "id": "248652415597752", "accessToken": "xxxxxxx...." }, "google": { "id": "107807511758741549898", "accessToken": "xxxxxxx...." } }

這個是要加上去的嗎?

@cody-ds
Copy link

cody-ds commented Mar 4, 2024

綜合google
{
"totp": {
"secret": "FDE393FE83ACAFEDAD3BC2931",
"timeOffset": -48392
},
"line": {
"id": "Uc024c41352524052525e330ec336d4be1",
"Token": ""
},
"lineNotify": {
"id": "Uc024c41352524052525e330ec336d4be1",
"Token": ""
},
"facebook": {
"id": "248652415597752",
"accessToken": "xxxxxxx...."
},
"google": {
"id": "107807511758741549898",
"accessToken": "xxxxxxx...."
}
}

@Aaron2963
Copy link
Author

另外,補充一點,LINE Notify 跟 LINE 的 OAuth 令牌不互通,所以如果兩者要並存,可能需要另存一個項目

@allen-fu-test
Copy link

allen-fu-test commented Mar 4, 2024

facebook id 之前是透過第三方登入呼叫facebook api
https://graph.facebook.com/v2.6/me?fields=name,email,gender....
傳入accesstoken回傳的參數
{"id": "xxxxxxxx", "email": "xxxxxxxxx"}

@Aaron2963
Copy link
Author

  1. line.Token, lineNotify.Token 這兩個鍵不走小寫駝峰有特別的意思嗎?
  2. tokenaccessToken 在意思上有區別嗎? 除了 TOTP 以外,其他都是 OAuth

@cody-ds
Copy link

cody-ds commented Mar 5, 2024

去掉id ,新增refreshToken 後,如下:
{
"totp": {
"secret": "FDE393FE83ACAFEDAD3BC2931",
"timeOffset": -48392
},
"line": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
},
"lineNotify": {
"accessToken": "xxxxxxx...."
},
"facebook": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
},
"google": {
"accessToken": "xxxxxxx....",
"refreshToken": "xxxxxxx...."
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment