Is there a way to make auth0 integration to accept...
# prisma-whats-new
l
Is there a way to make auth0 integration to accept RS256 signed JWT token?
n
@louislarry we're working on that already - currently we only support
HS256
though. You can subscribe to this feature request to stay notified: https://github.com/graphcool/feature-requests/issues/145
l
ah got it
ok
n
are you working with
auth0-js
?
l
yes
and from authorization api
n
for now you could downgrade to version 7 where
HS256
is still available
l
yes, for auth0-js I’ve downgraded to version 7
From my nativescript app, i use the auth0 authorization API directly
I’ll see if I can use auth0.js for my NativeScript
thank’s @nilan
👍 1
n
alright that would be great
l
no dice
auth0-js for some reason need access to tty which nativescript obviously doesn’t provide
Going to try creating id_token from access_token
I got it working
n
😎 that's amazing
l
Copy code
const rs = require('jsrsasign');
const rsu = require('jsrsasign-util');
const JWS = rs.jws.JWS;

const clientSecret = 'xxxxxxx';
const clientId = 'xxxxxxxx';
const domain = '<http://xxx.auth0.com|xxx.auth0.com>';
const userid = 'facebook|3498sdfasd5345';

const header = {
  typ: 'JWT'
};

const payload = {
  email_verified: true,
  sub: userid,
  iss: `https://${domain}/`,
  aud: clientId,
  exp: 1496879127,
  iat: 1496879127
};

const sJWS = JWS.sign('HS256', JSON.stringify(header), JSON.stringify(payload), clientSecret);

console.log(sJWS);
For reference to the others
n
What exactly is this doing?
l
use the sJWS as the idToken
it creates the idToken from access_token
add
Authorization: Bearer ${sJWS}
to the header
n
awesome, do you think you could write up a quick FAQ article about this in our docs? https://github.com/graphcool/content
l
I shall
n
would be super cool! it can be a simple markdown file and I take care of the frontmatter stuff 😛
l
ok
@nilan I’ve added a pull request to dev branch
n
that's awesome I'll have a look in the evening 🙏
l
okie 🙂