Detailed walkthrough of an implementation of ZBD Login.
code
after authenticating with ZEBEDEcode_verifier
from the response, after authenticating.code
as responsecode_challenge
from a code_verifier
which will be used later on, on token request.
getZBDLoginUrl
function
verifier
and code_challenge
findOneAndUpdate
represents an generic ORM call for updating the User model, on the database. This way we can, afterwards, retrieve that value for getting the token.createZBDOauth
, which uses oauth
library to do sogeneratePKCE
const verifier = base64URLEncode(crypto.randomBytes(32));
const challenge = base64URLEncode(sha256(verifier));
state
and code
which should be user now for getting the token, and user data:
code
and state
as query params.
Those values are send as payload on this next request:
const user = await User.findOne({ userId: state });
const res = await getAccessToken({…body})
const response = await getUserData(access_token);