GithubHelp home page GithubHelp logo

frankie567 / httpx-oauth Goto Github PK

View Code? Open in Web Editor NEW
138.0 4.0 46.0 4.26 MB

Async OAuth client using HTTPX

Home Page: https://frankie567.github.io/httpx-oauth/

License: MIT License

Python 100.00%
python3 async oauth2 oauth httpx

httpx-oauth's Introduction

HTTPX OAuth

Async OAuth client using HTTPX

build codecov PyPI version

All Contributors

Subscribe


Documentation: https://frankie567.github.io/httpx-oauth/

Source Code: https://github.com/frankie567/httpx-oauth


Installation

pip install httpx-oauth

Contributors ✨

Thanks goes to these wonderful people (emoji key):

François Voron
François Voron

🚧
Xavi Torelló
Xavi Torelló

💻
dbf
dbf

💻
Kenton Parton
Kenton Parton

💻
stepan-chatalyan
stepan-chatalyan

💻
Foster Snowhill
Foster Snowhill

💻
William Hatcher
William Hatcher

💻
Matt Chan
Matt Chan

📦
Goran Mekić
Goran Mekić

📦
Joona Yoon
Joona Yoon

💻
LindezaGrey
LindezaGrey

💻
R. Singh
R. Singh

🐛
Lukas Lösche
Lukas Lösche

🐛 💻
James King
James King

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Development

Setup environment

We use Hatch to manage the development environment and production build. Ensure it's installed on your system.

Run unit tests

You can run all the tests with:

hatch run test

Format the code

Execute the following command to apply isort and black formatting:

hatch run lint

Serve the documentation

You can serve the documentation locally with the following command:

hatch run docs

The documentation will be available on http://localhost:8000.

License

This project is licensed under the terms of the MIT license.

httpx-oauth's People

Contributors

allcontributors[bot] avatar dependabot-preview[bot] avatar dependabot[bot] avatar forst avatar frankie567 avatar gr3atwh173 avatar joonas-yoon avatar kentonparton avatar king-jam avatar lindezagrey avatar lloesche avatar mekanix avatar mj0nez avatar stepan-chatalyan avatar willemarcel avatar williamhatcher avatar xavitorello 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  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  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  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  avatar

httpx-oauth's Issues

Set OAuth scopes at init time

Discussed in #253

Originally posted by XaviTorello July 15, 2021
Will be great if scopes can be defined at init time and reused when needed.

Some methods like get_authorization_url needs to receive the scope as a param; our idea is to directly use the configured scopes for the current backend to avoid security issues (scopes should be received as an endpoint param, so everyone can change the requested scopes "in our name").

We've a working PoC, in short we'll submit a PR providing compatibility with current approach.

Related with fastapi-users/fastapi-users#664

Support Apple provider

Hello,

I have been using this library for a while and I missing the Apple Provider. There is any reason why is not included? For example, compared with Google, Apple uses POST instead of GET for the redirect-callback. Is this an issue? Too many changes in the current implementation?

Thanks

Support custom authorization server for OKTA client

OKTA allows to define custom authorization server instead of using the organization authorization server. This is a usual practice when your OKTA server has to support the authorization process of several applications.

The .well-know URL has a different format for those servers. It would be nice to support them as well.

I have unfortunately no time to make a proper pull request. But here would be the code to implement this little change adding a 'auth_Server_id' parameter to the constructoR..

class OktaOAuth2(OpenID):
    def __init__(
        self,
        client_id: str,
        client_secret: str,
        okta_domain: str,
        auth_server_id: Optional[str] = None,
        scopes: Optional[List[str]] = BASE_SCOPES,
        name: str = "okta",
    ):
        well_known_url = f"https://{okta_domain}/.well-known/openid-configuration" if auth_server_id is None \
            else f"https://{okta_domain}/oauth2/{auth_server_id}/.well-known/openid-configuration"
        super().__init__(
            client_id,
            client_secret,
            well_known_url,
            name=name,
            base_scopes=scopes,
        )

Timeout

Hi,
I get a "timeout" error when using the Oauth2 client for Facebook.
Is it possible to set the timeout parameter?

New endpoints

I tried to create a branch and make a pull request but I thinks that is not available, so I open here for discussion. I think that would be nice to have accesible the endpoint information for userinfo, logout and jwt.

class BaseOAuth2(Generic[T]):

    name: str
    client_id: str
    client_secret: str
    authorize_endpoint: str
    access_token_endpoint: str
    refresh_token_endpoint: Optional[str]
    revoke_token_endpoint: Optional[str]
    user_info_endpoint: Optional[str]
    logout_endpoint: Optional[str]
    jwk_endpoint: Optional[str]
    base_scopes: Optional[List[str]]

    def __init__(
        self,
        client_id: str,
        client_secret: str,
        authorize_endpoint: str,
        access_token_endpoint: str,
        refresh_token_endpoint: Optional[str] = None,
        revoke_token_endpoint: Optional[str] = None,
        user_info_endpoint: Optional[str] = None,
        logout_endpoint: Optional[str] = None,
        jwk_endpoint: Optional[str] = None,
        name: str = "oauth2",
        base_scopes: Optional[List[str]] = None,
    ):
        self.client_id = client_id
        self.client_secret = client_secret
        self.authorize_endpoint = authorize_endpoint
        self.access_token_endpoint = access_token_endpoint
        self.refresh_token_endpoint = refresh_token_endpoint
        self.revoke_token_endpoint = revoke_token_endpoint
        self.user_info_endpoint = user_info_endpoint
        self.logout_endpoint = logout_endpoint
        self.jwk_endpoint = jwk_endpoint
        self.name = name
        self.base_scopes = base_scopes

What do you think? Later would be nice to add functionalities to those endpoints

PKCE Support

Hey there! First of all, thank you for the library! This has been incredibly useful and educational for me!

I have a question around the PKCE support that is outlined in the docs here. I noticed from the docs that the code_verifier is listed as an Optional[str] under the get_access_token method defined on the OAuth2AuthorizeCallback, but I don't see how one could populate this argument. Is there a way to do this or is the argument added for potential future use?

Apologies if this seems like a simple question. Security isn't my strong suit!

Quick Question: For the OpenID client is there a way to configure the revoke token endpoint?

I've altered a package that integrates Streamlit with google auth (https://github.com/hunkim/streamlit-google-oauth) using this package. I altered it so it would use the OpenID client instead of the google one.

I've been sifting through the documentation for a couple of hours and I haven't been able to figure out where exactly I'm supposed to put the address to revoke the token for a log out button. I keep getting the RevokeTokenNotSupportedError(). I get that I'm supposed to put in the endpoint, but I'm not seeing a place to do that for the OpenID client.

Would I have to use a Generic client instead of the OpenID one? I'm pretty new to oauth, so I apologize if this is a dumb question.

GitHub OAuth responses are urlencoded, not JSON

First of all, thanks for this. It looks really great and I'm hoping it can save me a lot of time.

I'm running into an issue trying to get OAuth flow working with GitHub. I'm getting a 500 on the callback. It looks like an issue with httpx_oauth client.get_access_token

INFO:     127.0.0.1:51913 - "GET /auth/github/callback?code=<MY_CODE>&state=<MY_STATE> HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/applications.py", line 171, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
    await route.handle(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/routing.py", line 186, in app
    solved_result = await solve_dependencies(
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 537, in solve_dependencies
    solved = await call(**sub_values)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/httpx_oauth/integrations/fastapi.py", line 40, in __call__
    access_token = await self.client.get_access_token(code, redirect_url)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/httpx_oauth/oauth2.py", line 121, in get_access_token
    data = cast(Dict[str, Any], response.json())
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/httpx/_models.py", line 854, in json
    return jsonlib.loads(self.text, **kwargs)
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

Google Oauth: API key not valid

Google is telling me that my user API key is not valid when trying to get_id_email after receiving the user token in callback:

Traceback (most recent call last):
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/applications.py", line 171, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
    await route.handle(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/routing.py", line 196, in app
    raw_response = await run_endpoint_function(
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi/routing.py", line 147, in run_endpoint_function
    return await dependant.call(**values)
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/fastapi_users/router/oauth.py", line 88, in callback
  File "/Users/user/.local/share/virtualenvs/console-HZgljEfn/lib/python3.8/site-packages/httpx_oauth/clients/google.py", line 48, in get_id_email
    raise GetIdEmailError(response.json())
httpx_oauth.errors.GetIdEmailError: {'error': {'code': 400, 'message': 'API key not valid. Please pass a valid API key.', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developers console', 'url': 'https://console.developers.google.com'}]}]}}

I'm not sure where to start debugging.

Support GitHub refresh tokens

The REFRESH_ENDPOINT for github is https://github.com/login/oauth/access_token

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

Dependabot can't resolve your Python dependency files

Dependabot can't resolve your Python dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
[pipenv.exceptions.ResolutionFailure]:       Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
There are incompatible versions in the resolved dependencies.

['Traceback (most recent call last):\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 501, in create_spinner\n    yield sp\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 649, in venv_resolve_deps\n    c = resolve(cmd, sp)\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 539, in resolve\n    sys.exit(c.return_code)\n', 'SystemExit: 1\n']

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Python dependency files

Dependabot can't resolve your Python dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

ERROR: ERROR: Could not find a version that matches markdown<3.2,>=2.3.1,>=3.2
Tried: 1.7, 1.7, 2.0, 2.0, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.1.0, 2.1.0, 2.1.1, 2.1.1, 2.2.0, 2.2.0, 2.2.1, 2.2.1, 2.3, 2.3, 2.3.1, 2.3.1, 2.4, 2.4, 2.4.1, 2.4.1, 2.5, 2.5, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.6, 2.6, 2.6.1, 2.6.1, 2.6.2, 2.6.2, 2.6.2, 2.6.3, 2.6.3, 2.6.4, 2.6.4, 2.6.5, 2.6.5, 2.6.6, 2.6.6, 2.6.7, 2.6.7, 2.6.8, 2.6.9, 2.6.10, 2.6.11, 2.6.11, 3.0, 3.0, 3.0.1, 3.0.1, 3.1, 3.1, 3.1.1, 3.1.1, 3.2, 3.2
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:       req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches markdown<3.2,>=2.3.1,>=3.2
[pipenv.exceptions.ResolutionFailure]:       Tried: 1.7, 1.7, 2.0, 2.0, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.1.0, 2.1.0, 2.1.1, 2.1.1, 2.2.0, 2.2.0, 2.2.1, 2.2.1, 2.3, 2.3, 2.3.1, 2.3.1, 2.4, 2.4, 2.4.1, 2.4.1, 2.5, 2.5, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.6, 2.6, 2.6.1, 2.6.1, 2.6.2, 2.6.2, 2.6.2, 2.6.3, 2.6.3, 2.6.4, 2.6.4, 2.6.5, 2.6.5, 2.6.6, 2.6.6, 2.6.7, 2.6.7, 2.6.8, 2.6.9, 2.6.10, 2.6.11, 2.6.11, 3.0, 3.0, 3.0.1, 3.0.1, 3.1, 3.1, 3.1.1, 3.1.1, 3.2, 3.2
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches markdown<3.2,>=2.3.1,>=3.2
Tried: 1.7, 1.7, 2.0, 2.0, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.1.0, 2.1.0, 2.1.1, 2.1.1, 2.2.0, 2.2.0, 2.2.1, 2.2.1, 2.3, 2.3, 2.3.1, 2.3.1, 2.4, 2.4, 2.4.1, 2.4.1, 2.5, 2.5, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.6, 2.6, 2.6.1, 2.6.1, 2.6.2, 2.6.2, 2.6.2, 2.6.3, 2.6.3, 2.6.4, 2.6.4, 2.6.5, 2.6.5, 2.6.6, 2.6.6, 2.6.7, 2.6.7, 2.6.8, 2.6.9, 2.6.10, 2.6.11, 2.6.11, 3.0, 3.0, 3.0.1, 3.0.1, 3.1, 3.1, 3.1.1, 3.1.1, 3.2, 3.2
There are incompatible versions in the resolved dependencies.

['Traceback (most recent call last):\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 501, in create_spinner\n    yield sp\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 649, in venv_resolve_deps\n    c = resolve(cmd, sp)\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 539, in resolve\n    sys.exit(c.return_code)\n', 'SystemExit: 1\n']

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Github provider is hard coded to use the first email instead of the primary if no public one exists.

Currently in https://github.com/frankie567/httpx-oauth/blob/master/httpx_oauth/clients/github.py#L72
when no public email address is defined it is hard coded to use the first email address instead of the user's primary email address.

The response includes a boolean 'primary': True

[{'email': '[email protected]', 'primary': True, 'verified': True, 'visibility': 'public'}, {'email': '[email protected]', 'primary': False, 'verified': True, 'visibility': None}, {'email': '[email protected]', 'primary': False, 'verified': True, 'visibility': None}, {'email': 'xxxxxxxx@xxxxxxxx', 'primary': False, 'verified': True, 'visibility': None}]

NotImplementedError - get_id_email

First at all, thanks for the new release!!
Currently for the new release, the OAuth route, calls an methods that's not implemented yet, causing an exception NotImplementedError(). Probably would be nice to not call it until the method is implemented?

@router.get("/callback", name=f"{oauth_client.name}-callback")
    async def callback(
        request: Request,
        response: Response,
        access_token_state=Depends(oauth2_authorize_callback),
    ):
        token, state = access_token_state
        account_id, account_email = await oauth_client.get_id_email(
            token["access_token"]
        )

fastapi-users: 1.0.0
fastapi: 0.54.2

KeyError: 'grant_types_supported'

Hi there,
i am using Authelia as an OpenID Connect Provider. The openid_configuration_endpoint response does not inlcude the key "grant_types_supported" so the check

"refresh_token" in self.openid_configuration["grant_types_supported"]

fails and causes a crash. Since this line is only used for a optional feature later on:

token_endpoint if refresh_token_supported else None,

i would suggest to access the openid_configuration in a safer way like so:

refresh_token_supported = "refresh_token" in self.openid_configuration.get(
    "grant_types_supported", []
)

instead of

refresh_token_supported = (
    "refresh_token" in self.openid_configuration["grant_types_supported"]
)

I am by no means an expert on OAuth, so what is your opinion on this? Is this a legit issue? If not then maybe we could raise a more explicit error instead.

Enhancement: Litestar Integration

@frankie567 Thanks for putting together this great library.

I am one of the maintainers for the Litestar framework, and I have been working on a simple integration here. It's not ready for usage yet, but once it is, would be you open for a PR to enable this support? It would be great to have that integration here instead of a separate library.

Dependabot can't resolve your Python dependency files

Dependabot can't resolve your Python dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
Skipped pre-versions: 7.0b1, 7.0b1
There are incompatible versions in the resolved dependencies.
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]:       req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]:       resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]:   File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
[pipenv.exceptions.ResolutionFailure]:       Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
[pipenv.exceptions.ResolutionFailure]:       Skipped pre-versions: 7.0b1, 7.0b1
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches pymdown-extensions<6.3,>=6.2,>=6.3
Tried: 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.1, 1.1, 1.2, 1.2, 1.3, 1.3, 1.4, 1.4, 1.5, 1.5, 1.6, 1.6, 1.6.1, 1.6.1, 1.7, 1.7, 1.8, 1.8, 2.0, 2.0, 3.0, 3.0, 3.1, 3.1, 3.2, 3.2, 3.2.1, 3.2.1, 3.3, 3.3, 3.4, 3.4, 3.5, 3.5, 4.0, 4.0, 4.1, 4.1, 4.2, 4.2, 4.3, 4.3, 4.4, 4.4, 4.5, 4.5, 4.5.1, 4.5.1, 4.6, 4.6, 4.7, 4.7, 4.8, 4.8, 4.9, 4.9, 4.9.1, 4.9.1, 4.9.2, 4.9.2, 4.10, 4.10, 4.10.1, 4.10.1, 4.10.2, 4.10.2, 4.11, 4.11, 4.12, 4.12, 5.0, 5.0, 6.0, 6.0, 6.1, 6.1, 6.2, 6.2, 6.2.1, 6.2.1, 6.3, 6.3
Skipped pre-versions: 7.0b1, 7.0b1
There are incompatible versions in the resolved dependencies.

['Traceback (most recent call last):\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 501, in create_spinner\n    yield sp\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 649, in venv_resolve_deps\n    c = resolve(cmd, sp)\n', '  File "/usr/local/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pipenv/utils.py", line 539, in resolve\n    sys.exit(c.return_code)\n', 'SystemExit: 1\n']

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Add params to the urls itself.

AUTHORIZE_ENDPOINT = "https://{shop}.myshopify.com/admin/oauth/authorize"
ACCESS_TOKEN_ENDPOINT = "https://{shop}.myshopify.com/admin/oauth/access_token"
PROFILE_ENDPOINT = "https://{shop}.myshopify.com/admin/api/2020-10/users/current.json"

How can I pass shop param to this urls? How can I let users send this param with fastapi_users.get_oauth_router?

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.