Skip to content

Fail to get toke using encoded client credentials #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
juhyun opened this issue Aug 3, 2022 · 0 comments
Closed

Fail to get toke using encoded client credentials #88

juhyun opened this issue Aug 3, 2022 · 0 comments

Comments

@juhyun
Copy link

juhyun commented Aug 3, 2022

According to the authlib document, if user uses'client_secret_basic' client auth method, 'HTTP Basic Authorization' can be used. However, with 'HTTP basic Authorization' it failed to get token.

  1. Successfully getting token using "curl -u <client_id>:<client_format>"
    [root@server ~]# curl -u e7Ll5b67Xv5zZKZBuLLwoOWm:gkZICKnukGLDQmT0PMa1Yp2r11dKL7OmLjiKZFGwMPLRAGrn -XPOST http://127.0.0.1:5001/oauth/token -F grant_type=password -F username=opuser -F password=valid
    {"access_token": "MWptz8DVDYYfqYy6inSHq2phkvZZ6fyo8TgDEgEpKK", "expires_in": 864000, "refresh_token": "oQJpPhiTXi10AzfwNfoKQshvE4YosI86FMHY4ban5BzG7JI3", "token_type": "Bearer"}

  2. Failed to get token using "encoded client credentials"
    [root@server ~]# echo -n 'e7Ll5b67Xv5zZKZBuLLwoOWm:gkZICKnukGLDQmT0PMa1Yp2r11dKL7OmLjiKZFGwMPLRAGrn' | base64
    c
    [root@server ~]#
    [root@server ~]# curl -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic ZTdMbDViNjdYdjV6WktaQnVMTHdvT1dtOmdrWklDS251a0dMRFFtVDBQTWExWXAycjExZEtMN09tTGppS1pGR3dNUExSQUdybg==" -XPOST http://127.0.0.1:5001/oauth/token -F grant_type=password -F username=opuser -F password=valid
    {"error": "invalid_grant"}

-----------Updated---------------
Oh, without using '-H "Content-Type: application/x-www-form-urlencoded"', http basic authentication works fine..

@juhyun juhyun closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant