Welcome
Login
Sign up
Home
Solutions
Forums
How can we help you today?
Enter your search term here...
Search
Login
or
Signup
to submit a new ticket
Check ticket status
Start a new topic
Discussions
Kinvey Forums
JavaScript
Why is the activeUser null even though I am logged in?
M
Mark
started a topic
over 7 years ago
I am using the following code to get the active user, however user is null even though I am logged in.
Kinvey.init({
appKey : 'App Key',
appSecret : 'App Secret'
});
var activeUser = Kinvey.getActiveUser();
// Do stuff with the activeUser.
2 Comments
Oldest First
Popular
Newest First
Sorted by
Oldest First
M
Mark
said
over 7 years ago
The active user is restored asynchronously as part of the `Kinvey.init` call. The following will return the activeUser:
Kinvey.init({
appKey : 'App Key',
appSecret : 'App Secret'
}).then(function(activeUser) {
// Do stuff with the activeUser.
}, function(error) {
// An error occured.
});
Or, if you are using traditional callbacks:
Kinvey.init({
appKey : 'App Key',
appSecret : 'App Secret',
success : function(activeUser) {
// Do stuff with the activeUser.
},
error : function(error) {
// An error occured.
}
});
B
Braiek Miled
said
over 3 years ago
I have the same Problem here, and this code didn't work for me
can you help me ? :)
Login
or
Signup
to post a comment
More topics in
JavaScript
How do I use Kinvey in my web app?
Is it safe to include keys/secrets in my client-side JavaScript app?
Login does not work even though credentials are valid.
Social login doesn’t work.
Appending objects to an Array (HTML5 - JS)
New to node.js - need bootstrap to downloadfiles from Kinvey
Problem with Aggregation/Grouping
Internal Server Error using Twitter Sign Up
Data Store
See all 315 topics
Mark
Kinvey.init({
appKey : 'App Key',
appSecret : 'App Secret'
});
var activeUser = Kinvey.getActiveUser();
// Do stuff with the activeUser.