replaced .then() with .success()

.then() won't provide the token fetched as parameter to the function so replaced it with .success()