appinfo.getAuthKey - GiGAGenie-ServiceSDK/UserGuide GitHub Wiki

gigagenie.appinfo.getAuthKey

API μ„€λͺ…

  • AuthKey 쑰회 API
  • ν•΄λ‹Ή 앱에 λŒ€ν•œ G-Box의 AuthKeyλ₯Ό μ‘°νšŒν•¨

API ꡬ쑰

  • function getAuthKey(options,callback)
  • options
    • null
  • result_cd
    • 200: 성곡
    • 404: AuthKey μ„€μ •λ˜μ–΄ μžˆμ§€ μ•ŠμŒ
    • 500: μ‹œμŠ€ν…œ Error
  • extra
    • authkey: (String) authKey κ°’
    • settime: (String) authKey κ°€ μ„€μ •λœ μ‹œκ°„(ν˜•μ‹: YYYYMMDDhhmmss, 20170519184202)
    • duetime: (String) authKey 의 만료 μ˜ˆμ • μ‹œκ°„
    • sid: (String) sid κ°’(result_cdκ°€ 200μ΄κ±°λ‚˜ 404일 λ•Œ 전달)

μ‚¬μš© μ˜ˆμ‹œ

// callback 방식
var options = {};
gigagenie.appinfo.getAuthKey(options, function (result_cd, result_msg, extra) {
    if (result_cd === 200) {
        console.log("Key value is " + extra.authkey);
        console.log("SetTime value is " + extra.settime);
        console.log("DueTime value is " + extra.duetime);
    } else if (result_cd === 404) {
        console.log("Key is not set.");
    } else {
        console.log("getAuthKey is fail.");
    }
});
// promise 방식
var options = {};
gigagenie.appinfo.getAuthKey(options).then(function (extra) {
    console.log("Key value is " + extra.authkey);
    console.log("SetTime value is " + extra.settime);
    console.log("DueTime value is " + extra.duetime);
}).catch(function (result_cd, result_msg, extra) {
    if (result_cd === 404) {
        console.log("Key is not set.");
    } else {
        console.log("getAuthKey is fail.");
    }
})