Realm in Swift3.0 unexpected status code: -34018 - realm

run this code
SyncUser.authenticate(with: Credential.usernamePassword(username: username, password: password, actions: [.useExistingAccount]), server: Constants.syncAuthURL) { (user, error) in }
return -34018 error code
libc++abi.dylib: terminating with uncaught exception of type realm::keychain::KeychainAccessException: Keychain returned unexpected status code: -34018
breakpoint in
_dispatch_once(dispatch_once_t *predicate,
DISPATCH_NOESCAPE dispatch_block_t block){
if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) {
dispatch_once(predicate, block);
} else {
dispatch_compiler_barrier();
}
DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l);}
THX

-34018 means errSecMissingEntitlement. Try to specify an entitlements file, even if it contains no entitlements, can work around this problem.
See more at: https://github.com/realm/realm-cocoa/issues/4158

Related

Ejabberd [warning] Unexpected info $gen_event

Warning message, that I'm trying to get rid off.
[warning] Unexpected info: {'$gen_event',
{xmlstreamstart,<<"stream:stream">>,
[{<<"xmlns:stream">>,
<<"http://etherx.jabber.org/streams">>},
{<<"xmlns">>,<<"jabber:client">>},
{<<"version">>,<<"1.0">>},
{<<"to">>,<<"example.com">>}]}}
My users connect via xmpp.js from example.com website
import { client } from '#xmpp/client';
const xmppClient = client({
service: "ejabberd-ws.example.com",
domain: "example.com",
credentials: async(auth) => {
try {
const res = await request('https://example.com/ejabberd/config');
const username = res.data['jid'];
const password = res.data['password'];
if (!password) {
console.error('Xmpp password is empty, null, false or undefined');
return this.xmpp.disconnect();
}
auth({ username, password });
} catch (e) {
return this.xmpp.disconnect();
}
}
});
It is ejabberd version 22.10
Do any of you guys know what exactly is causing this warning message?
I would like to get rid of it or at least understand what is causing it.

Meteor Account.createUser TypeError: Cannot read property 'accessToken' of undefined

I try to create User Registration. I have install
accounts-base 1.2.2* A user account system
accounts-password 1.1.4* Password support for accounts
On client side :
var userNew = {
password: textPassword,
username: textUserName,
profile: {
address: textAddress
}
};
Accounts.createUser(userNew, function (err) {
if (err) {
alert(err.message);
} else {
Router.go('/');
}
});
But show error :
I20160423-17:47:07.299(7)? Exception while invoking method 'createUser' TypeError: Cannot read property 'accessToken' of undefined
Also i have set on server side :
Accounts.config({
forbidClientAccountCreation : false
});
I done with update & recreate PROJECT. I dont figure whats the problems. but recreate project solved this problems.
Hopelly its helps others

Firebase authWithCustomToken throwing an error instead of calling callback?

I am following the example in the docs:
ref.authWithCustomToken(authToken, function(error, authData) {
if (error) {
console.log("Authentication Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
}
});
If I pass an invalid token to authWithCustomToken (e.g. authToken is undefined) , it throws an Error, rather than passing an error code to the callback. In other words, neither console.log is executed, but this error is thrown:
First argument must be a valid credential (a string).
Wrapping it in try catch solves the problem easily enough, but I didn't see any mention in the docs. Is it the intended behaviour?
In my use-case the token is passed through a url, so an undefined parameter is a possible error condition.
From firebase-debug.js:
if (!goog.isString(cred)) {
throw new Error(fb.util.validation.errorPrefix(fnName, argumentNumber, optional) + "must be a valid credential (a string).");
}
What probably happened:
You passed a non-string value as authToken so the error not happened in the Firebase (server) side, it happened in the client side (your side) so it will be not reported on the callback function but as Javascript exception in your code.
Possible workaround (I don't know why, but if you want)
If you want to pass a variable as authToken and it could not be a string, and you still want to get the "Wrong credentials" error, instead of type validation, then you need to force string conversion using:
var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
var numberAuthToken = 212312312312312; // number
var stringAuthToken = String(numberAuthToken);
ref.authWithCustomToken(stringAuthToken, function(error, authData) {
if (error) {
console.log("Authentication Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
}
});
But it not makes sense for me. :)

How do I retrieve the error message thrown by Future from the server to the client?

Inside my server, I that checks some data from the database and throws an error when it's not valid. I have it like so:
//SERVER CODE:
Meteor.methods({
send: function (prefix, number, content) {
Future = Npm.require('fibers/future');
var future = new Future();
//do some validation
myReference.doSomething({
number: number,
content: content
}, function(error) {
if(error) {
future.throw("Cannot send at this time.");
} else {
future.return("SUCCESS");
}
});
return future.wait();
}
});
In the client side, I would like to get the message "Cannot send at this time." inside future.throw("Cannot send at this time.");. Hopefully I could show it inside an alert. How do I do that?
Currently, this is what I'm trying and I keep getting some undefined error.
//CLIENT CODE
Meteor.call("send", prefix, number, content, function(err, result) {
if(err) {
console.log(err);
alert(err);
} else {
console.log("SUCCESSFULLY SENT. ", result);
}
});
This is the error I get when trying to get the error message:
errorClass: Internal server error [500]
{
error: 500,
reason: "Internal server error",
details: undefined, message: "Internal server error [500]",
errorType: "Meteor.Error"…}
details: undefined
error: 500
errorType: "Meteor.Error"
message: "Internal server error [500]"reason:
"Internal server error"stack: (...)get
stack: function () { [native code] }set stack:
function () { [native code] }__proto__: Middle
How do I get the error message that I threw from future?
Use it like that: return future.throw(new Meteor.Error(400, 'ololo'))
future.throw expects an Meteor.Error instance that in it's turn contains error message itself and additionally http response code. So 400 is Bad Request response code in that case and ololo is error message.
return isn't actually necessary here but I do it every time just to be sure I don't call any code after failure.

Firebase ResetPassword issue

I am building user authentication in my website using Angular and Firebase's Email & Password authentication framework. This is NOT using the Firebase Simple Login Framework but the newly introduced native framework.
My code links to Firebase using:
<script src="https://cdn.firebase.com/js/client/1.1.0/firebase.js"></script>
I can create users, login and so on but the ResetPassword call fails with the following error.
Error: Firebase.resetPassword failed: First argument must be a valid object.
at Error (native)
at E (https://cdn.firebase.com/js/client/1.1.0/firebase.js:15:73)
at F.G.td (https://cdn.firebase.com/js/client/1.1.0/firebase.js:192:79)
at Object.resetPassword (http://localhost:8000/src/js/services/loginservice.js:78:27)
at k.$scope.resetPassword (http://localhost:8000/src/js/controllers.js:35:20)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js:177:68
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js:171:237
at f (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js:194:174)
at k.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js:112:68)
at k.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js:112:346)
The code I use is from the firebase example as follows:
ref.resetPassword(email, function(error) {
if (error === null) {
console.log("Password reset email sent successfully");
} else {
console.log("Error sending password reset email:", error);
}
});
I have verified that a valid email id is being passed in.
Can you please let me know what the issue is?
Thanks in advance
vm
According to the firebase documentation, you should be passing in an object not a string.
https://www.firebase.com/docs/web/api/firebase/resetPassword.html
var credentials = {email: email};
ref.resetPassword(credentials, function(error) {
if (error === null) {
console.log("Password reset email sent successfully");
} else {
console.log("Error sending password reset email:", error);
}
}
I have found that using an object no longer works, it would keep giving me "First argument must contain the key "email", even then the object was as the answer above.
After much frustration i got it working passing the email parameter as per the firebase docs.
$scope.resetPassword = function(email){
console.log("made in to auth method for reset passowrd with email - " + email);
ref.resetPassword({
email: email
}, 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!");
}
});
}

Resources