anvilresearch / connect-nodejs Goto Github PK
View Code? Open in Web Editor NEWAnvil Connect JavaScript client for Node.js
Home Page: http://anvil.io
License: MIT License
Anvil Connect JavaScript client for Node.js
Home Page: http://anvil.io
License: MIT License
In my application I do the following
client.token({code: 'aabbcc'})
.then(function(){
client.register({})
})
.catch(...)
The token sent to the register endpoint is Bearer undefined
because in the client->register function the token is got like this:
var token = this.tokens && this.tokens.access_token
but this.tokens
is undefined. Am I doing something wrong?
Extract the non-OIDC Admin API (user/client/etc management) to its own standalone client lib.
I've run into an issue in a few instances where an access token is not being verified by AccessToken.verify and the "Insufficient scope" error is being thrown, it's coming from this line:
https://github.com/anvilresearch/connect-nodejs/blob/master/lib/AccessToken.js#L160
I wonder if this check is too restrictive, e.g if an access token has the scope:
"openid email profile phone"
And the Anvil Connect instance is configured with the scope:
"openid profile phone email"
Equally if an access token has any additional scopes the verification will also fail.
Is this by design? Should the scope verification match the exact string, or could we explode the scopes string into components and check that the JWT scopes match on a per-scope basis? Or maybe I'm missing something about this scope verification check entirely?
Happy to provide a patch for this but wanted to check up on the motivation for this design beforehand.
Hi,
are there any plans to support the .well-known/openid-configuration endpoint of a openid connect server? It should simplify setup somewhat.
Regards,
Daníel
We can eliminate the need to configure a public key for JWT verification by fetching JWKs from the auth server. This will require updates to https://github.com/christiansmith/anvil-connect-jwt as well, so we can verify signatures from hN + hE instead of a PEM encoded public key.
In order to use much of the Anvil-specific API (say to create users), the nodejs client needs an access token.
From talking with @christiansmith, it sounds like that token comes from one of two places:
client_credentials
grant (works like an API key).In the context of client.users.create()
, there isn't a user yet, so no access token is possible from that source. Which means, the client should be able to load that client access token. So:
Implement client.loadClientCredentials()
:
.initProvider()
to load endpoints etc./token
endpoint, w client_id + client_secret.grant_type=client_credentials
For reference:
The test Access Token verify with verifiable JWT and mismatching audience should provide an error description
is failing due to anvilresearch/connect-jwt#5 and this is becoming an issue.
Been looking around in the code as to what is generating the following error:
Access Token verify with verifiable JWT and mismatching audience should provide an error description
I can't find any mention of the AccessToken.decode function
I wouldn't mind taking a crack at it if you can tell me a little about what exactly it is supposed to return.
I try to use updateUser for changing user's password, but it don't work.
Workaround is adding changePassword method into
https://github.com/anvilresearch/connect-nodejs/blob/master/rest/users.js
something like this
function changePassword (id, password, options) {
options = options || {}
options.url = '/v1/users/' + id + '/password'
options.method = 'PATCH'
options.json = {password: password}
return request.bind(this)(options)
}
exports.changePassword = changePassword
Please add it into some future release
Setting this to for example the access_token
gives [TypeError: Cannot read property 'indexOf' of undefined]
in a .catch
error message.
You may want to add in something like:
self.tokens = tokens
in connect-nodejs/index.js
to your token function (starts around line 260)
Currently the userinfo function is trying to access anvil.tokens
which does not exist.
(This is using the example code from the README)
Implement signout()
function that hits the OIDC provider's /signout
API endpoint, and passes along the required params:
id_token_hint
(the ID Token of the signed in user)post_logout_redirect_uri
(must be one of the pre-registered post-logout redirect urls)A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.