Search code examples
apihttpauthenticationoauth-2.0saas

OAuth2 - What grant should I use?


I'm trying to figure out which OAuth2 grant to use for my application/saas. Or if OAuth2 is even the correct way to go.

The application:

The purpose of the application is for use and integration with e-commerce. So what I want is for the user is to go to my site and register an account. After the account has been created the user should be provided with credentials with which he/she can acquire an access- and refresh-token. The access-token should provide access to the users OWN resources and preferably use scopes to limit access. The user should the be able to get/post/put and delete stuff from his/her account as if working in the provided administration (SPA). They should not have to go through the OAuth redirect flow, because they will be using the API from their servers.

My thoughts

First I considered going for the Client Credentials grant. But then I found out that it will not provide access to a user and it's resources. I've started leaning towards using the Resource owner credentials grant. But I don't put a lot of faith in my users picking strong passwords. And in almost all documentation I can find, everyone seems to not recommend using this grant.

Maybe OAuth is not suitable for my project? Maybe I should go for some API Key which can be traded for an access token?

Any thoughts and/or input?


Solution

  • Came to the conclusion that OAuth2 was not correct for my situation.

    In the end I chose to go with a custom solution based on JWT.