blob: 134107c276b1f6586f244b41488ba97ea31dcdc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*
headers: {
"x-yoox-appname": auth.appname,
"x-yoox-account-token": auth.access_token,
"x-yoox-device": auth.device,
"x-yoox-api-key": auth.apikey,
},
*/
var auth = sdk.auth = (function(){
var auth = {}
auth.appname = is_iphone ? "native-iphone-stoneisland/1.0.0" : "native-android-stoneisland/1.0.0"
auth.apikey = "U2FsdGVkX18fThqg9bF0/ZgE9Jg948hn8O9EXli4B2729nAESCQaexv//M5+7+za"
auth.device = "smartphone"
auth.access_token = ""
auth.user_id = -1
// ios: integrate keychain api
// android: cordova.file.externalRootDirectory api
auth.set_user = function(user_id, access_token){
// persist user data
auth.user_id = user_id
auth.access_token = access_token
}
auth.get_user = function(cb){
// fetch user data
}
auth.log_out = function(){
auth.user_id = -1
auth.access_token = ""
}
auth.logged_in = function(){
return (auth.user_id !== -1)
}
return auth
})()
|