Best oauth grant type to use for my application

135 views Asked by At

I'm a php developer for my firm, and I'm kindoff stuck with this concept form Oauth. I've been searching the web and read almost every article I could find about oAuth but still it won't get to me how to handle this situation.

I live in the Netherlands so forgive me if my writing is sometimes a little bit off.

I'm working on an application for our company. Its an online work platform, where people can sign up to to find work.

We sell our online application to companies who offer jobs and such.

So we have for every company that buys our web application an url like: http://companyname.onlinejobs.com ( for example ). So we have backend users that can login in their application and they each have different roles and permissions.

We also have http://onlinejobs.com as a website where everybody can sign up to view job oppertunities and much more. So we also have a frontend user, that also can have multiple roles, such as a free user and a premium user.

We've build a REST API that holds all methods to add and view jobs and profiles etc etc. We want this API to only be accesible to the clients that we register. So if I register company1.onlinejobs.com than that in my opinion is a client, and can only use our api.

But now we want to intergrate oAuth to the situation. We want the API to be protected from any unregistered clients, but we also want to make sure that a frontend free user, cannot access surtain api calls that a premium frontend user can make.

or is that permission based behaviour not something for oAuth? Wich grant type that oAuth2 uses can we use for our situation? I really need some help with this guys.. Hope somebody can give me a clear explanation about what to use best, or maybe even not at all.

1

There are 1 answers

3
Saravanan On

We had a similar use case and we built our own authorization server that can handle the following use cases

  • Authentication and authorization from the
  • web applications
  • javascript enabled apps [Like SPA apps]
  • Native apps like windows services or windows apps

We have used the following flows in OAuth2.0

  1. Authorization Code
  2. Implicit flow
  3. Resource owner credentials

Hence, the right choice of the flow needs to be decided on the types of applications that you plan to support.

HTH