This question is locked. New answers and comments are not allowed.
All,
I am using the Javascript SDK to create a new user and keep getting the error {"message":"The provided access token is invalid or has expired","code":301}.
I can see my App ID coming through in the service correctly, and when I see the URL that is called using chrome inspector, it appears to be valid and the AppID is the same as what is in the platform dashboard. I must be missing something...
Any and all help appreciated!
I am using my App ID in the following way:
app.js
.value(
'TelerikConfiguration'
, {
url:
"//api.everlive.com/v1/"
,
applicationId:
'123xyz'
})
UserSvc.js
angular.module(
'Bairfinder'
).
service(
'UserSvc'
,
function
(TelerikConfiguration) {
var
el =
new
Everlive({
apiKey: TelerikConfiguration.applicationId,
url: TelerikConfiguration.url,
scheme:
'https'
,
token: localStorage.getItem(
'sessionToken'
)
});
console.log(
'applicationId:'
+ TelerikConfiguration.applicationId);
console.log(
'url:'
+ TelerikConfiguration.url);
return
{
newAccount : {
email:
''
,
password:
''
,
firstName:
''
,
lastName:
''
,
phone:
''
,
hasAcceptedTerms:
false
,
isAge18:
false
},
currentUser:
function
(){
//return Parse.User.current();
return
el.Users.currentUser();
},
loginUser:
function
(user, password) {
//return Parse.User.logIn(user, password);
return
el.Users.login(user, password);
},
loginUserBySessionToken:
function
(sessionToken){
console.log(
'loginUserBySessionToken:'
+ sessionToken);
//var promise = Parse.User.become(sessionToken);
var
promise = el.authentication.setAuthorization(sessionToken,
'bearer'
);
console.log(JSON.stringify(promise));
return
promise;
},
createUser:
function
(newAccount){
var
self =
this
;
//if (newAccount.hasAcceptedTerms && newAccount.isAge18){
var
attrs = {
email: newAccount.email,
firstName: newAccount.firstName,
lastName: newAccount.lastName,
phone: newAccount.phone
//,
//ACL: new Parse.ACL()
};
//return Parse.User.signUp(self.newAccount.email, self.newAccount.password, attrs);
return
el.Users.register(self.newAccount.email, self.newAccount.password, attrs);
//}
},
resetUserPwd:
function
(newAccount){
var
self =
this
;
console.log(
'resetUserPwd:'
+ JSON.stringify(self));
//return Parse.User.requestPasswordReset(self.newAccount.email);
return
el.users.resetPassword(newAccount);
}
};
});