We are building a REST API that will be consumed by our own mobile app as well as others. We want to secure it from being publicly accessible with an API key which seems to fit within oAuths Client Credentials Grant definition.
Some API endpoints, such as those that would modify a user resource, would require the user to be authenticated which seems to fit within the Resource Owner Password Credentials Grant definition.
This question essentially summarizes the same scenario linked to below but failed to ask for any examples of what the actual implementation might look like:
This is a difficult question to frame up. I've looked at as many similar questions as I could find and none of them really seem to answer the following:
How would the flow for something like this work? Would the client just pass an API key parameter/header with every request in addition to requesting/passing an access_token for the user on certain endpoints?
Are there any publicly accessible examples out there in the wild of this particular use case in terms of source code (ruby/rails in particular)?
Also, I'm not strictly tied to oAuth, so let me know if there are other secure and proven ways to do the same type of thing.