Skip to content

Commit

Permalink
chore(deps): bump authlib from 0.15.2 to 1.3.1 (#174)
Browse files Browse the repository at this point in the history
* chore(deps): bump authlib from 0.15.2 to 1.3.1

Bumps [authlib](https://github.com/lepture/authlib) from 0.15.2 to 1.3.1.
- [Release notes](https://github.com/lepture/authlib/releases)
- [Changelog](https://github.com/lepture/authlib/blob/master/docs/changelog.rst)
- [Commits](lepture/authlib@v0.15.2...v1.3.1)

---
updated-dependencies:
- dependency-name: authlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix login KeyError id_token after authlib-1.3.1

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: QSummerY <1272750872@qq.com>
  • Loading branch information
dependabot[bot] and QSummerY authored Jul 9, 2024
1 parent 055d5a7 commit 2d08f51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mysqlclient>=1.4.2
cached-property>=1.5.1
st2client==3.3.0
rule==0.1.1
Authlib==0.15.2
Authlib==1.3.1
httpx==0.*
fastapi==0.*
fastapi_pagination==0.9.3
12 changes: 6 additions & 6 deletions helpdesk/views/auth/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ async def callback(oauth_provider: str, request: Request):
oauth_client = oauth_clients[oauth_provider]

token = await oauth_client.authorize_access_token(request)
id_token = await oauth_client.parse_id_token(request, token)
logger.debug("auth succeed %s", id_token)
userinfo = token['userinfo']
logger.debug("auth succeed %s", userinfo)

username = oauth_username_func(id_token)
email = id_token['email']
username = oauth_username_func(userinfo)
email = userinfo['email']

access = id_token.get('resource_access', {})
access = userinfo.get('resource_access', {})
roles = access.get(oauth_client.client_id, {}).get('roles', [])

user = User(name=username, email=email, roles=roles, avatar=id_token.get('picture'))
user = User(name=username, email=email, roles=roles, avatar=userinfo.get('picture', ''))

request.session['user'] = user.json()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mysqlclient>=1.4.2
cached-property>=1.5.1
st2client==3.3.0
rule==0.1.1
Authlib<=1.0.1
Authlib<=1.3.1
httpx==0.*
fastapi==0.*
fastapi_pagination==0.9.3

0 comments on commit 2d08f51

Please sign in to comment.