I’m looking into redirecting a user after a social signup to an external page with a Token, validating the token using a RS256 signed certificate, adding additional user information and redirecting him to the /continue signup URL.
My problem is that i can not add my PEM certificate when creating the rule. (I need to use the RS256 signing system).
The error i get is :
error:0906D06C:PEM routines:PEM_read_bio:no start line
I found a post where a user replaces all the line endings in the PEM file by a special token and reparses the cert. I don’t think this is a good way to go. Does anyone know how i can retrieve the private cert in a rule?
EDIT:
my rule looks like this ATM:
var options = {
algorithm: 'RS256',
expiresIn: "5m",
audience: configuration.CLIENT_ID,
issuer: configuration.ISSUER
};
var token = jwt.sign({
sub: user.user_id,
email: user.email
},
configuration.CLIENT_SECRET,
options,
function(err, token) {
if (err) {
console.log(err);
return callback(new UnauthorizedError("Error"));
}
context.redirect = {
url: "http://localhost:8020/signup?token=" + token
};
return callback(null, user, context);
}
);
But the CLIENT_SECRET should be replaced with the Certificate.