You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public IActionResult GenerateJwtToken()
{
var tokenHandler = new JwtSecurityTokenHandler();
var secretKey = Encoding.ASCII.GetBytes("--- change me now ---");
var jsonformu = new { _id = "647db743f08587cd2dd707cf" };
var jsonuser = new { _id = "external", data = new { name = "externaluser", email = "extuser@example.com" },
roles= new[] { "647db743f08587cd2dd707cf" }};
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new[]
{
new Claim("external", "true"),
new Claim("form", "{\r\n "_id":"647db743f08587cd2dd707cf"\r\n }"),
new Claim("user", "{\r\n "_id":"external",\r\n "data":{\r\n "name":"joe"\r\n },\r\n "roles":[\r\n "646341cc696df649c911183a"\r\n ]\r\n }")
}),
Expires = DateTime.UtcNow.AddMinutes(30),
SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(secretKey),
SecurityAlgorithms.HmacSha256Signature
)
};
var token = tokenHandler.CreateToken(tokenDescriptor);
var authorizedtoken = tokenHandler.WriteToken(token);
return Ok();
}
When sending it to the formio server, on localhost it's giving Unauthorized error. Where do I look in the formio-master to find the problem? and where do I look in the formio-master if I want to configure OpenId Connect or OAuth for formio?
The text was updated successfully, but these errors were encountered:
@msiukdev any updates? Are you using our open source container or our Enterprise container? Truth be told, I'm not sure what kind of SSO support we provide in our open source container, although I suspect it could work. Give us a few more details and we'll try to get you sorted out.
I was creating a token with an external user, using the following link : https://help.form.io/developers/integrations/auth.
Here's my token generating function using c# code.
public IActionResult GenerateJwtToken()
{
var tokenHandler = new JwtSecurityTokenHandler();
var secretKey = Encoding.ASCII.GetBytes("--- change me now ---");
var jsonformu = new { _id = "647db743f08587cd2dd707cf" };
var jsonuser = new { _id = "external", data = new { name = "externaluser", email = "extuser@example.com" },
roles= new[] { "647db743f08587cd2dd707cf" }};
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new[]
{
new Claim("external", "true"),
new Claim("form", "{\r\n "_id":"647db743f08587cd2dd707cf"\r\n }"),
new Claim("user", "{\r\n "_id":"external",\r\n "data":{\r\n "name":"joe"\r\n },\r\n "roles":[\r\n "646341cc696df649c911183a"\r\n ]\r\n }")
}),
Expires = DateTime.UtcNow.AddMinutes(30),
SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(secretKey),
SecurityAlgorithms.HmacSha256Signature
)
};
When sending it to the formio server, on localhost it's giving Unauthorized error. Where do I look in the formio-master to find the problem? and where do I look in the formio-master if I want to configure OpenId Connect or OAuth for formio?
The text was updated successfully, but these errors were encountered: