You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Further integration between oAuth 2.0 and LoopBack #817
I did some basic testing. The oAuth 2.0 token based authentication is already working with ACLs if you enable the middleware on your resource/api server that serves the model endpoints.
Hi raymondfeng ,
My scenario is using 'ClientCredentials' grant type to be able to generate accesstoken based on Client id and Client secret as we don't have any resource owner conept. Here are steps that I have done so fat:
Created my own application model which extends Application model
Registered my client application into application model from which I got Client Id and Client secret(restapikey)
Here are my questions and can you please direct me (code base) on how to achieve this
I need to pass this clientid and Client secret to 'ClientCredentials' grant type to get accesstoken from authorization server, right?
Based on accesstoken if my client tries to access restapi how does ACL know which user he is being looged in? as my accesstoken does not have userid
+1
I am working on an application that need throttling and autentication to get access to my api.
I need information because maybe i missunderstood the concept. If I create ACL and roles in the api server, the gateway doent know anything about this users and this roles.
the access_token is only to pass through the proxy and if you need an access_token to this end point its not the same.
By the way, i want to know if there are any chance to autenticate with oauth2 as an anonymous user, because in our use case makes sense to keep some state or session to a gest that doesnt have account yet.
I need to get working my application quickly so by the moment i am deleting all the gateway stuff and implement the autentication directly in the api server.
Thank you for your job because is a great framework to create apis really quick but some features are not yet ready to be in production.
The oAuth 2.0 token based authentication is already working with ACLs if you enable the middleware on your resource/api server that serves the model endpoints
@raymondfeng Which middleware are you referring to ?
Does this mean that we can store OAuth tokens directly inside LB's AccessToken model, using node api equivalent of POST /User/{id}/accessTokens ? And still benefit from entire loopback ACL system ? That would be ideal
The approach I would use is similar to what Gitlab does, use OAuth2 for first connection to acquire user email, then let the user generate a password. It's not exactly the full OAuth2 flow, but at least in the end you can create a regular User with Loopback, and benefit from ACL/Authentication/etc.
Eventually, if you need interaction with the OAuth provider, then you might be able to store credentials/token/whatever inside the Loopback User and pass those credentials to the OAuth provider when you need to.
I haven't completely tested this approach so I might be missing something here, but my guess is this should work.
Activity
jkernech commentedon Nov 26, 2014
+1
XinV commentedon Dec 4, 2014
+1
gagan-bansal commentedon Jan 15, 2015
+1
robotiko commentedon Feb 16, 2015
+1
zetflo commentedon Mar 5, 2015
+1
raymondfeng commentedon Mar 5, 2015
I did some basic testing. The oAuth 2.0 token based authentication is already working with ACLs if you enable the middleware on your resource/api server that serves the model endpoints.
archana09 commentedon Mar 12, 2015
Hi raymondfeng ,
My scenario is using 'ClientCredentials' grant type to be able to generate accesstoken based on Client id and Client secret as we don't have any resource owner conept. Here are steps that I have done so fat:
Here are my questions and can you please direct me (code base) on how to achieve this
skyserpent commentedon Apr 10, 2015
+1
XinV commentedon Apr 11, 2015
+1, some code examples and instruction walking through would be much helpful.
SkyBone42 commentedon May 4, 2015
+1
danielrvt commentedon May 25, 2015
+1
luksch commentedon May 27, 2015
+1 this would be awesome! Thanks for all the effort that goes into this.
mercuriete commentedon May 27, 2015
+1
I am working on an application that need throttling and autentication to get access to my api.
I need information because maybe i missunderstood the concept. If I create ACL and roles in the api server, the gateway doent know anything about this users and this roles.
the access_token is only to pass through the proxy and if you need an access_token to this end point its not the same.
By the way, i want to know if there are any chance to autenticate with oauth2 as an anonymous user, because in our use case makes sense to keep some state or session to a gest that doesnt have account yet.
I need to get working my application quickly so by the moment i am deleting all the gateway stuff and implement the autentication directly in the api server.
Thank you for your job because is a great framework to create apis really quick but some features are not yet ready to be in production.
asanchezdelc commentedon Jun 3, 2015
Hey guys, I was able to get a working example with oAuth2, passport, and ACL.
https://github.com/qbanguy/loopback-gateway2
Overdrivr commentedon Jul 20, 2016
@raymondfeng Which middleware are you referring to ?
Does this mean that we can store OAuth tokens directly inside LB's AccessToken model, using node api equivalent of
POST /User/{id}/accessTokens? And still benefit from entire loopback ACL system ? That would be idealJonnyBGod commentedon Dec 13, 2016
Is this still in the pipeline or is it better to create our own solution?
AlexDM0 commentedon Mar 21, 2017
I've added an option for oauth2 and loopback to live side by side. If you're interested, it's all available:
https://github.com/crownstone/loopback-component-oauth2
Yaty commentedon Dec 12, 2017
Any update ? I can't use OAuth2 at all with those ACL issues :(
Overdrivr commentedon Dec 15, 2017
The approach I would use is similar to what Gitlab does, use OAuth2 for first connection to acquire user email, then let the user generate a password. It's not exactly the full OAuth2 flow, but at least in the end you can create a regular User with Loopback, and benefit from ACL/Authentication/etc.
Eventually, if you need interaction with the OAuth provider, then you might be able to store credentials/token/whatever inside the Loopback User and pass those credentials to the OAuth provider when you need to.
I haven't completely tested this approach so I might be missing something here, but my guess is this should work.