when user tries to log in (does sign in) and forgets his password then he tries to reset his password then how does the app call Rest Password by email, since the user has not signed in-ed to Quickblox yet. Doesn't the user need to be signed in to QuickBlox in order to call an API?
just create session (without user) and reset your password
[QBAuth createSessionWithDelegate:self];
-(void)completedWithResult:(Result *)result{
if(result.success && [result isKindOfClass:QBAAuthSessionCreationResult.class]){
//success
// reset password
[QBUsers resetUserPasswordWithEmail:#"myemail#gmail.com" delegate:self];
}else if (result.success && [result isKindOfClass:Result.class]){
// you did it
}
}
User can use forget password feature if he can't login the app.
So no, user doesn't need to be signed in to QuickBlox in order to call an API.
Related
I have a URL say http://myproj-com/trailer-video/_token
Every time user hits the above URL, I want the user to log into my system.
_token will be unique for each user and will be stored in users table.
Is there any way to login the user and get the user information in auth() object without providing email and password?
You can do it using the login function of Auth as:
Route::get('trailer-video/{token}', function($token) {
$user = User::where('token', $token)->first();
if($user) {
auth()->login($user);
}
dd(auth()->user());
});
I need to logout user from my app.
I use TwitterKit/Fabric to logIn.
[TwitterKit logInWithCompletion:^(TWTRSession *session, NSError *error)
{
}];
and try to logOut with this :
[TwitterKit logOut];
the TwitterKit login set the user account in the iPhone -> Settings -> Twitter and
when I try to login again logInWithCompletion automatically the logIn the user
when I use logOut nothing happens.
Would love to hear suggestions to this problem.
[TwitterKit logOut];
It Deletes the local Twitter user session from this app. This will not remove the system Twitter account nor make a network request to invalidate the session.
ref:https://dev.twitter.com/twitter-kit/ios-reference/twitter
I'm implementing social login with oauth using the package oauth-4-laravel in my laravel application.
Following the instructions of the package I'm able to connect with facebook or with google.
Now I don't want to store user data but still I want a user to access a page only if legged with facebook or google.
I have to check if a user is logged with oauth in a route filter. Something like this
Route::filter('auth', function()
{
if (!OAuth::check()) return Redirect::guest('login');
});
How do I do that? Or should I use another method?
Typically even when you use OAuth as authentication method, your application will still have to store user_id or name, and their email isn't it? If so, you can still apply laravel authentication like so:
//After the OAuth authentication
$user = User::where('email', $email)->firstOrFail(); //$email is the email returned from OAuth
//without acessing DB
$user = new User();
$user->email = $email; //this is an eg, can be replace with whatever user's properties you have.
Auth::login($user); //login the user using laravel
//To logout user manually
Auth::logout();
//In your filters.php
Route::filter('auth', function()
{
if (Auth::guest())
return Redirect::guest('login');
});
We are using QuickBlox's iOS SDK for chat implementation.
Currently we have only two view controllers 1). Login and 2). UserList
After successful login app moves to UserList view in this view we have Logout button.
According to QuickBlox API we have use below method for logout
[QBUsers logOutWithDelegate:self];
on button click and its delegate method :
- (void)completedWithResult:(Result *)result
{
if([result isKindOfClass:[QBUUserLogOutResult class]]) // QuickBlox User Logout result
{
// Success result
if(result.success)
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
}
}
After successful logout app moves back to login screen.
Problem :
When user clicks on logout and app moves to Login screen and again if user input same user name and password then log prints
Chat App[3183:5903] -[QBChat loginWithUser:] -> return. Already logged in
How to resolve this issue ? OR What is the best practice to implement Login/Logout flow ?
According to SDK reference, exist session, simply user login and login to chat.
1) you need create session. You may create it simply:
[QBAuth createSessionWithDelegate:self];
or with extended request:
QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
extendedAuthRequest.userLogin = #"garry";
extendedAuthRequest.userPassword = #"garrySant88";
[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];
(If you create session with extended request, pass second action)
2) Perform simply login by
[QBUsers logInWithUserLogin:currentUser password:pass delegate:self]
3) after that for using chat:
[[QBChat instance] loginWithUser:currentUser];
For logout you should perform logout methods in back order.
[[QBChat instance] logout];
after that:
[QBUsers logOutWithDelegate:self];
and:
[QBAuth destroySessionWithDelegate:self];
Recreation of session not necessarily. You can create one session and many times login/logout.
I'm trying to create a password reset mechanism and am stuck. Any suggestions how to do this with Firebase basic email/password authentication
[Engineer at Firebase - Update 2014-01-27]
Firebase Simple Login now supports password resets for email / password authentication.
Each of the Simple Login client libraries has been given a new method for generating password reset emails for the specified email address - sendPasswordResetEmail() on the Web and Android, and sendPasswordResetForEmail() on iOS.
This e-mail will contain a temporary token that the user may use to log into their account and update their credentials. This token will expire after 24 hours or when the user changes their password, whichever occurs first.
Also note that Firebase Simple Login enables full configuration of the email template as well as the sending address (including whitelabel email from your domain for paid accounts).
To get access to this feature, you'll need to update your client library to a version of v1.2.0 or greater. To grab the latest version, check out https://firebase.google.com/docs/.
Also, check out https://firebase.google.com/docs/auth/web/password-auth for the latest Firebase Simple Login - Web Client docs.
This is something that Firebase doesn't do very well. As you'll notice it requires the user to remember their old password. Usually if you want to reset a password it's because you've forgotten it. Hopefully the improve the methods they provide for account management.
https://www.firebase.com/docs/security/simple-login-email-password.html
authClient.changePassword(email, oldPassword, newPassword, function(error, success) {
if (!error) {
console.log('Password change successfully');
}
});
This was the first google result that came up when trying to figure out my issue.. for anyone who uses yeoman angularfire generator but would like to add the send email feature, this should work.
add the following to the simple login factory in simpleLogin.js:
resetPassword: function(emailIn){
return auth.$resetPassword({
email: emailIn
}, function(error) {
if (error) {
switch (error.code) {
case "INVALID_USER":
console.log("The specified user account does not exist.");
break;
default:
console.log("Error resetting password:", error);
}
} else {
console.log("Password reset email sent successfully!");
}
});
},
and call it from your login.js file
$scope.resetPassword = function(email){
simpleLogin.resetPassword(email)
};