GithubHelp home page GithubHelp logo

oauth's People

Contributors

jeffreydwalter avatar jwalter1-quest avatar pkieltyka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oauth's Issues

Time to tag?

Hi, we're a new user of this module, which is great. Thanks a lot to the maintainers.
It seems pretty stable; isn't it a good time to tag it in order to ease its maintenance via go modules?

Documentation on how to use context on client. Why contextKey type?

After adding the middleware router.Use(oauth.Authorize("mySecretKey-10101", nil)) and being able to authorize a user, I had some issues figuring out how to access the information of the access token using the Context.

The middleware.go file adds the token information to the Context using a new type that is basically a string. Code in question:
`type contextKey string

const (
CredentialContext contextKey = "oauth.credential"
ClaimsContext contextKey = "oauth.claims"
ScopeContext contextKey = "oauth.scope"
TokenTypeContext contextKey = "oauth.tokentype"
AccessTokenContext contextKey = "oauth.accesstoken"
)`

Given that the context is accessed using r.Context().Value(key) and that key is basically a string, I thought I had to access the claims just by using r.Context().Value("oauth.claims") but this approach returned nil.

To successfully access the token information in the context I had to import the oauth package and use the consts that I put above since their type is not a string but contextKey. Working Example:
r.Context().Value(oauth.ClaimsContext)

I was wondering why this contextKey type is used instead of using a string

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.