-
-
Save azamsharp/e4b4dbd350571233412331f4c5b8c66a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/services/jwt',(req,res) => { | |
const header = { | |
"alg": "ES256", | |
"typ": "JWT", | |
"kid": "yourmapidkey" | |
} | |
const payload = { | |
"iss": "yourteamid", | |
"iat": Date.now() / 1000, | |
"exp": (Date.now() / 1000) + 15778800, | |
} | |
var cert = fs.readFileSync('./private.p8'); // the private key you downloaded from Apple Developer Website | |
var token = jwt.sign(payload,cert, { header: header } ); | |
res.json({token: token}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment