新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

RSA-SHA256 JWT Box Integration

新規投稿

コメント

2件のコメント

  • Murtza

     I am not sure if this will help, but here is how our Noke SDK generates a token using JWT authentication.

    0
    コメントアクション パーマリンク
  • vinodtiwari10
    Thanks for sharing document but that is not working at our end for RSA-SHA256, 
    and I need 1 source code of any either JavaScript or NodeJS because
    my system is not accepting any reference call like: Module, require is not defined:


    var
    jwt = require('jsonwebtoken'); var fs = require('fs'); var base64url = require("base64url"); var request = require('request'); var client_id = 123 var client_secret = 123 var key = fs.readFileSync('23er444'); var passphrase = 3444 var exp = Math.round((Date.now()/1000))+60; var header = { "alg": "RS256", "typ": "JWT", "kid": keyID }; var claims = { "iss": client_id, "sub": "sss", "box_sub_type": "user", "aud": "https://api.box.com/oauth2/token", "jti": "ddsss", "exp": exp }; var encodedHeader = base64url(new Buffer(JSON.stringify(header))); var payload = base64url(new Buffer(JSON.stringify(claims))); var signature = jwt.sign(encodedHeader + '.' + payload, {key: key, passphrase: passphrase}, {algorithm: 'RS256'}); var encodedsignature = base64url(new Buffer(JSON.stringify(signature))); var jwt = encodedHeader + "." + payload + "." + encodedsignature; return jwt; var options = { uri: 'https://api.box.com/oauth2/token',method: 'POST',json: true,headers: {'content-type': 'application/x-www-form-urlencoded'},body: 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&client_id=' + client_id + '&client_secret=' + client_secret + '&assertion=' + jwt };

        

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。