I want to use JWT login with unity-sdk and auth0.
I want to pass an id_token from auth0 to web3auth vi unity-sdk.
Documents says
To use the `JWT` login, you need to put the jwt token into the `additionalParams` field of the `extraLoginOptions`.
But sample code seems different.
I cannot find what key is available in additionalParams.
Does anyone have samples to use JWT login?
vjgee
July 9, 2023, 7:34am
2
@shuichi.fushimi Thanks for reaching out.
I have forwarded your request to our team to check and will get back with an update once more information becomes available.
In the meantime, are you able to use the sample code for JWT login:
void Start()
{
web3Auth = GetComponent<Web3Auth>();
var loginConfigItem = new LoginConfigItem()
{
verifier = "custom-jwt-verifier", // get it from web3auth dashboard
typeOfLogin = TypeOfLogin.JWT,
};
web3Auth.setOptions(new Web3AuthOptions()
{
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"),
clientId = "BAwFgL-r7wzQKmtcdiz2uHJKNZdK7gzEf2q-m55xfzSZOw8jLOyIi4AVvvzaEQO5nv2dFLEmf9LBkF8kaq3aErg",
network = Web3Auth.Network.TESTNET,
// Optional loginConfig object
loginConfig = new Dictionary<string, LoginConfigItem>
{
{"jwt", loginConfigItem}
}
});
}
public void login()
{
var selectedProvider = Provider.JWT;
var options = new LoginParams()
{
loginProvider = selectedProvider,
extraLoginOptions = new ExtraLoginOptions()
{
verifierIdField = "sub",
id_token = "your_jwt_token",
}
};
web3Auth.login(options);
}
Here is an example for Unity with Auth0:
@vjgee
Thank you for your rapid response
Yes, I have already tried the example and it does not work well because ExtraLoginOptions
does not have id_token
field. (please see following definition of ExtraLoginOptions)
I also passed my_jwt_token
to id_token_hint
but it does not work too.
using System.Collections.Generic;
public class ExtraLoginOptions {
public Dictionary<string, string> additionalParams { get; set; }
public string domain { get; set; }
public string client_id { get; set; }
public string leeway { get; set; }
public string verifierIdField { get; set; }
public bool isVerifierIdCaseSensitive { get; set; }
public Display display { get; set; }
public Prompt prompt { get; set; }
public string max_age { get; set; }
public string ui_locales { get; set; }
public string id_token_hint { get; set; }
public string login_hint { get; set; }
public string acr_values { get; set; }
public string scope { get; set; }
public string audience { get; set; }
public string connection { get; set; }
public string state { get; set; }
This file has been truncated. show original
The example code and the following sentence in your documents seems doing different thing.
To use the JWT
login, you need to put the jwt token into the additionalParams
field of the extraLoginOptions
.
vjgee
July 10, 2023, 6:55am
4
Our team are checking on this and we will get back with further updates once more information becomes available.
1 Like
vjgee
July 21, 2023, 7:42am
7
@shuichi.fushimi This has been fixed in the latest version 1.3 of the Unity SDK. Please upgrade to the same
1 Like
@vjgee
Thank you for updating.
I tried JWT token with updated sdk and found another problem.
When I login with setting auth0 idToken to here , OpenLogin page became like following picture.
And console log shows following errors.
Do you have any idea how to solve this?
customauth.esm.js:1994 Error: Duplicate token found
at torusUtils.esm.js:78:20
at <anonymous>
getRedirectResult @ customauth.esm.js:1994
loglevelSentry.esm.js:56 Error: Could not get result from torus nodes
Duplicate token found
at _ (customAuthError.ts:67:11)
at Proxy.created (Callback.vue:148:53) Object Object 'Could not get result from torus nodes \n Duplicate token found' Object 'mounted caught'
n @ loglevelSentry.esm.js:56
1 Like
vjgee
July 31, 2023, 3:20pm
9
I am checking this with our team and we will get back with further updates.
1 Like
shuichi.fushimi:
Duplicate token
Sorry for the delay, @shuichi.fushimi . This is a known error which is discussed in brief here. Basically, this error is thrown when the JWT is sent twice in the same request.
system
Closed
October 21, 2023, 10:59pm
11
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.