-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Description
The the genDpopToken function, add optional argument to method signature allowing the user to supply a nonce value. If supplied, add the nonce value to tokenBody map as the below code shows.
String genDpopToken(String endPointUrl, KeyPair rsaKeyPair, dynamic publicKeyJwk, String httpMethod, {String nonce = '',})
var tokenBody = {
"htu": endPointUrl,
"htm": httpMethod,
"jti": uniqueTokenId,
"iat": (DateTime.now().millisecondsSinceEpoch / 1000).round(),
};
if (nonce.isNotEmpty) {
tokenBody['nonce'] = nonce;
}Why
It is now common that servers will return a nonce to the caller of the method to get an access token. The client then has to repeat the request for a access token and supply the nonce value in the DPoP token.
Additional Context
For now, I have create my own version of the solid_auth package so I can have this feature.
If you implement this feature, you may want to consider adding the ability to pass multiple key, value so the user can have add or more additional values to the tokenBody.
Thank you very much for solid_auth. It is such a powerful and professionally written package. I learned a lot.
I only use two functions from the solid_auth package: genRsaKeyPair and genDpopToken in my Flutter app so I can support DPoP tokens.
Best to the team of experts that wrote this package.
Below is the DPoP token I created with two added key-values: nonce and deviceId.
eyJhbGciOiJSUzI1NiIsInR5cCI6ImRwb3Arand0IiwiandrIjp7ImUiOiJBUUFCIiwia3R5IjoiUlNBIiwibiI6IjN6Y3dWQ2t2bzZOeWFzcDY1V29GS1paWS1Gd1hKUHAyQ0JIYkdWWGxaNVY0XzBtdWstZEpDYktKdzdnYmZNc3oyWDk1WllNd2ZUNkpIcmpCQnJ4X0pFUF9oQ1Z1WFRvVHNIQWE5YWhHZ2QzT0ZsZ0diZ2VjcDJMR0FEX1ZRQzZJNG14UHlLSnpHa2dsdW82eWFwYmdIQV9pMDQ4RVFoa1o4MkNEU1I4UVdHcXpPcGtXbFNQYWo0eHFXSzJwSHdHTGRjRU53Zm8yUXR1WGFSU2d6b0s0d1lmZ19vTFdQLTA1ZGJlR0Fnb1pacVBYZG5EazVNb1VqZEVOckdsVjBJZE1VN29YUUVUbTV4QXpUWUlTVTUtN29CMHNnYmdmeHFFcjVfWFhrdnEyT2xJQ1dn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