Giter Site home page Giter Site logo

Comments (2)

 avatar commented on August 25, 2024 1

Currently, the only way in Passport to pass your access token is through the Authorization header. Passing it through the query string is extremely dangerous, see here and here.

When using Passport as your guard, this is how you it checks for an authenticated user.

/**
 * Get the user for the incoming request.
 *
 * @param  Request  $request
 * @return mixed
 */
public function user(Request $request)
{
    if ($request->bearerToken()) {
        return $this->authenticateViaBearerToken($request);
    } elseif ($request->cookie('laravel_token')) {
        return $this->authenticateViaCookie($request);
    }
}

So bearer token explicitly checks for the authorization header, but the cookie method simply looks for the laravel_token cookie to be present during the request. The CreateFreshApiToken method sounds like it might work for you since you don't need to pass headers, just a simple cookie which the browser should handle automatically assuming your javascript doesn't have any problems.

That being said, that method also relies on how your intranet is setup and whether or not you have a "domain" which a cookie can be attached to.

from passport.

poxin13 avatar poxin13 commented on August 25, 2024

I do agree that it's dangerous and went ahead skipping that function completely in my project. I appreciate the information regarding the cookie, that may prove useful in the future. Went ahead and did a more regular method of authorization from the intranet app.

from passport.

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.