Skip to content

Commit 42af753

Browse files
committed
Remove unused auth0 call for refreshing token
Also removes unused code for firebase auto login
1 parent 4fabf3c commit 42af753

File tree

2 files changed

+8
-45
lines changed

2 files changed

+8
-45
lines changed

app/scripts/services/CurrentUser.coffee

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,13 @@ angular.module('neo4jApp.services')
124124
login: ->
125125
q = $q.defer()
126126
that = @
127-
@autoLogin().then(
128-
->
129-
q.resolve()
130-
,
131-
->
132-
NTN.login().then((res) ->
133-
that.persist res
134-
data = localStorageService.get 'ntn_profile' || {}
135-
$rootScope.$emit 'ntn:login', data
136-
q.resolve(res)
137-
)
127+
NTN.login().then((res) ->
128+
that.persist res
129+
data = localStorageService.get 'ntn_profile' || {}
130+
$rootScope.$emit 'ntn:login', data
131+
q.resolve(res)
132+
,
133+
(err) -> q.reject()
138134
)
139135
q.promise
140136

@@ -155,38 +151,9 @@ angular.module('neo4jApp.services')
155151

156152
isAuthenticated: -> localStorageService.get 'ntn_data_token'
157153

158-
autoLogin: ->
159-
that = @
160-
q = $q.defer()
161-
if NTN.isAuthenticated()
162-
q.resolve()
163-
return q.promise
164-
token = localStorageService.get('ntn_token')
165-
if not token
166-
q.reject()
167-
return q.promise
168-
q.reject()
169-
q.promise
170-
171-
refreshToken: ->
172-
that = @
173-
NTN.refreshToken(localStorageService.get('ntn_refresh_token')).then((token)->
174-
that.persist({token: token.token, data_token: token.data_token})
175-
that.autoLogin()
176-
)
177-
178154
init: ->
179155
NTN.connection()
180156

181-
$rootScope.$on 'ntn:token_will_expire', () ->
182-
cu.refreshToken()
183-
184-
$rootScope.$on 'ntn:token_expired', () ->
185-
cu.autoLogin()
186-
187-
$rootScope.$on 'ntn:connection_status', (s, isConnected) ->
188-
if isConnected then cu.autoLogin()
189-
190157
cu = new CurrentUser
191158
cu
192159
]

app/scripts/services/NTN.coffee

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ angular.module('neo4jApp.services')
4141
ref = new Firebase("https://fiery-heat-7952.firebaseio.com/users/#{id}/")
4242
fbauth = $firebaseAuth ref
4343
fbauth.$authWithCustomToken(token).then(
44-
(auth_data)->
45-
if auth_data.expires - Math.round((new Date()).getTime()/1000) < 60*60*12
46-
$rootScope.$emit 'ntn:token_will_expire'
47-
44+
(success) ->
4845
q.resolve(ref)
4946
,
5047
(err) ->
@@ -63,7 +60,6 @@ angular.module('neo4jApp.services')
6360
,
6461
(err)->
6562
_unbind()
66-
$rootScope.$emit 'ntn:token_expired'
6763
)
6864

6965
_push = (_store, data) ->

0 commit comments

Comments
 (0)