GithubHelp home page GithubHelp logo

LINE OAuth Strategy about assent HOT 5 CLOSED

pow-auth avatar pow-auth commented on May 26, 2024
LINE OAuth Strategy

from assent.

Comments (5)

danschultzer avatar danschultzer commented on May 26, 2024 1

That would be great!

Looks like they support OIDC which is very easy to add an integration for. You can take a look at the Azure AD integration (ignoring the tenant logic), and the docs for OIDC base integration:

https://github.com/pow-auth/assent/blob/master/lib/assent/strategies/azure_ad.ex
https://github.com/pow-auth/assent/blob/master/lib/assent/strategies/oidc/base.ex

For the tests I usually copy values from the provider documentation: https://github.com/pow-auth/assent/blob/master/test/assent/strategies/azure_ad_test.exs#L6

from assent.

wingyplus avatar wingyplus commented on May 26, 2024

@danschultzer Thanks for your inform. I'll read and open PR today. :)

from assent.

wingyplus avatar wingyplus commented on May 26, 2024

@danschultzer LINE Login use HS256 for ID Token. How do we change alg to use HS256 instead of RS256?

@danschultzer since LINE Login use alg HS256 for ID Token. After I try passing params to the callback I received error like this:

{:error, "`alg` in ID Token can only be \"RS256\""}

After read and inspecting code. I found that error come from OIDC.validate_id_token/2 in step verify_alg/2 after passing verify_jwt/3 which's returns alg HS256 in the header. Is it should be check HS256 in verify_alg/2 or need another option to make it work on HS256?

from assent.

wingyplus avatar wingyplus commented on May 26, 2024

It's work fine if we set id_token_signed_response_alg in openid_configuration but it's requires another configuration to make it works. This is sample configuration that it's works for me:

  def default_config(_config) do
    [
      site: "https://access.line.me",
      authorization_params: [scope: "email profile", response_type: "code"],
      openid_configuration: %{
        "id_token_signed_response_alg" => ["HS256"],
        "issuer" => "https://access.line.me",
        "authorization_endpoint" => "https://access.line.me/oauth2/v2.1/authorize",
        "token_endpoint" => "https://api.line.me/oauth2/v2.1/token",
        "jwks_uri" => "https://api.line.me/oauth2/v2.1/certs"
      }
    ]
  end

I need to set this manually because well known openid configuration doesn't returned id_token_signed_response_alg:

$ curl https://access.line.me/.well-known/openid-configuration
{
  "issuer": "https://access.line.me",
  "authorization_endpoint": "https://access.line.me/oauth2/v2.1/authorize",
  "token_endpoint": "https://api.line.me/oauth2/v2.1/token",
  "jwks_uri": "https://api.line.me/oauth2/v2.1/certs",
  "response_types_supported": [ "code" ],
  "subject_types_supported": [ "pairwise" ],
  "id_token_signing_alg_values_supported": [ "ES256" ]
}

Do you have any suggestion?

from assent.

danschultzer avatar danschultzer commented on May 26, 2024

Yeah, found out the handling of the response alg was incorrect. It was a bit difficult to understand from the RFC:

  1. The alg value SHOULD be the default of RS256 or the algorithm sent by the Client in the id_token_signed_response_alg parameter during Registration.

But I looked at other OIDC implementations, and setting it as a configuration option seems to be the way to do it. #59 handles that, and I've refactored #58 to use the new configuration option so we don't need to set the open id config manually. I'll get a new release out shortly!

from assent.

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.