title: Oauth2 Golang - Own database and users
body: <p>I'm building a web application in Golang, and at the moment I'm struggling with the authentication/authorization mechanisms.</p>
  
  <p>I want to deploy this app to different platforms (browsers, androids, etc). To achieve this I chosed to use oauth 2.0, namely this lib: <a href="https://github.com/golang/oauth2" rel="nofollow noreferrer">https://github.com/golang/oauth2</a> .</p>
  
  <p>The problem I'm facing is how to achieve this with my own database and users. The lib has a jwt package (<a href="https://github.com/golang/oauth2/tree/master/jwt" rel="nofollow noreferrer">https://github.com/golang/oauth2/tree/master/jwt</a>) and also has a package clientcredentials (<a href="https://github.com/golang/oauth2/blob/master/clientcredentials/clientcredentials.go" rel="nofollow noreferrer">https://github.com/golang/oauth2/blob/master/clientcredentials/clientcredentials.go</a>) that can be used for 2-legged Oauth 2.0, but I have no idea how to achieve this, and can't find any example showing it. Which package should I use? The token should be set when user sends a POST with its credentials at <a href="http://example.domain/login" rel="nofollow noreferrer">http://example.domain/login</a>.</p>
  
  <p>Can someone provide me some hints / show me a simple example?</p>