Giter Club home page Giter Club logo

Comments (6)

jebrosen avatar jebrosen commented on September 22, 2024

What kind of validation are you trying to do? I expect the answer to be pretty specific to the API that provides the access_token, so this may be better asked there (or it may be in their documentation).

from rocket_oauth2.

jeluard avatar jeluard commented on September 22, 2024

I am using github OAuth as a mean of user identification. Once they're logged and I have access to the token, I'd like to use this to validate others endpoint.
I know how to validate a github token but I am wondering if there is a some specific workflow in rocket_oauth2 to handle this lifecycle? (token refresh, invalidation if expired, ..)

from rocket_oauth2.

jebrosen avatar jebrosen commented on September 22, 2024

Although the TokenResponse includes the refresh_token and expires_in values if the authorization server provided them, I would consider actually using the values as out of scope for rocket_oauth2. Since the only sure way to validate an access token is to attempt to use it, rocket_oauth2 would need to have a validation mechanism for every provider in order for this to actually work.

rocket_oauth2 does provide a convenient way to make that refresh request, at least: https://docs.rs/rocket_oauth2/0.3.0/rocket_oauth2/struct.OAuth2.html#method.refresh

from rocket_oauth2.

jeluard avatar jeluard commented on September 22, 2024

Thanks!

from rocket_oauth2.

jeluard avatar jeluard commented on September 22, 2024

@jebrosen To check a Github token both client_id and client_secret are needed. Is there a way to get this from OAuth2 in an arbitrary endpoint?

from rocket_oauth2.

jebrosen avatar jebrosen commented on September 22, 2024

@jeluard It can't be accessed via OAuth2, but I would be happy to accept a PR for that.

There is also https://docs.rs/rocket_oauth2/0.3.1/rocket_oauth2/struct.OAuthConfig.html#method.from_config, which can be used once at startup to read the configuration in the same way OAuth2::fairing() does. That would allow you to store the client_id and client_secret in managed state somewhere.

from rocket_oauth2.

Related Issues (20)

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.