Reputation: 2218
I am using this library: https://github.com/manjeshpv/node-oauth2-server-implementation
From my understanding of Oauth2:
1)Generate a clientid and clientSecret
2)User use clientId and clientSecret to get a bearerToken
3)Authorisation server returns accessToken to users if valid clientId and clientSecret combination
4)User then use the accessToken to run http post/get api calls (within their scope)
In the POSTMAN examples given in the GITHUB, we have
I noticed Password Grant, Refresh Token ,Client Credential Grant and Authorisation Grant points to the same POST request with the difference in the body.
and the Authorise sample web service, which I assume is that user would have to click in order for the authorisation server to return an access code for user to call scope specific API urls, but somehow access code is needed too, which I'm confused.
and If I use Client Credential Grant (which I assume is to return an AccessToken using my clientId and clientSecret), then what's the point of the authorise webservice?
What would be the right flow for this library and webservices example?
Would really appreciate help in this, thanks!
Upvotes: 0
Views: 59
Reputation: 2817
and the Authorise sample web service, which I assume is that user would have to click in order for the authorisation server to return an access code for user to call scope specific API urls, but somehow access code is needed too, which I'm confused.
Your terminology is a bit confused. Here is a probably most popular OAuth flow:
clientid
and clientSecret
redirect_uri
defined at step 1). This code is short-term and cannot be used to access user's data.clientId
and clientSecret
and gets authorization token in exchange. This token can be used to access user's data.and If I use Client Credential Grant (which I assume is to return an AccessToken using my clientId and clientSecret), then what's the point of the authorise webservice?
Token got by ClientCredentials grant identifies client, but not user. So I guess it is useless in your case.
Upvotes: 1