GithubHelp home page GithubHelp logo

Comments (9)

jacobweber avatar jacobweber commented on July 24, 2024 1

Basically, at the point where the example generates an authorization code, I do something like this:

if ($params['response_type'] === 'code') {
    // Generate an authorization code
    [...]
} else if ($params['response_type'] === 'token') {
    $params["grant_type"] = "implicit";
    $response = $server->issueAccessToken($params);
    return Redirect::to(
        League\OAuth2\Server\Util\RedirectUri::make($params['redirect_uri'],
        array(
            "access_token" => $response["access_token"],
            "token_type" => "bearer",
            "state" => isset($params['state']) ? $params['state'] : ''
        ), "#")
    );
}

from oauth2-server.

jacobweber avatar jacobweber commented on July 24, 2024

Also, there doesn't seem to be anything corresponding to getGrantType('authorization_code')->checkAuthoriseParams() for implicit grants. Should we continue calling that, even though it's on the wrong class?

from oauth2-server.

alexbilbie avatar alexbilbie commented on July 24, 2024

There is an undocumented (and untested) Implicit grant in the library which you can use.

Can I ask why you need the implicit grant? I strongly recommend that you avoid it

from oauth2-server.

jacobweber avatar jacobweber commented on July 24, 2024

That's what I've been using -- I just didn't realize that it was untested.

I'm using it because my client is a JavaScript app, with no server. So there's no place to store a "client secret". My understanding is that implicit grants are the way to go with browser-only apps.

from oauth2-server.

alexbilbie avatar alexbilbie commented on July 24, 2024

That's correct however please read this if you haven't already https://github.com/php-loep/oauth2-server/wiki/Which-OAuth-2.0-grant-should-I-use%3F#implicit-grant-section-42

from oauth2-server.

jakelehner avatar jakelehner commented on July 24, 2024

Did you get this working @jacobweber? I have not been able to get the Implicit grant to work yet and noticed the same question you posed regarding checkAuthoriseParams(). So naturally, getGrantType('implicit')->checkAuthoriseParams() fails.

from oauth2-server.

jacobweber avatar jacobweber commented on July 24, 2024

Yes, I have it working. I use getGrantType('authorization_code')->checkAuthoriseParams().

from oauth2-server.

jakelehner avatar jakelehner commented on July 24, 2024

@jacobweber, did you have to do anything else? When I leave authorization_code in the that line I get something back, but it's not the expected format for implicit. It sends me to the redirect URL but it's sending me back with an authcode rather than a token.

It also appears to be creating an authcode in the DB rather than a token.

Did you have to add logic to your authorise() function to handle the implicit requests differently?

from oauth2-server.

jakelehner avatar jakelehner commented on July 24, 2024

Cool that's what I figured I was missing. Makes total sense.

Thanks @jacobweber !

from oauth2-server.

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.