Skip to content
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

Do not check token-type. #37

Open
kwinso opened this issue Aug 23, 2022 · 1 comment
Open

Do not check token-type. #37

kwinso opened this issue Aug 23, 2022 · 1 comment
Labels
noncompliant Issue is caused by a noncompliant provider

Comments

@kwinso
Copy link

kwinso commented Aug 23, 2022

I'm trying to implement VK OAuth2, but their API responds with JSON like this (idk why, they even put a link to OAuth specs):

{
  "access_token": "533bacf01e11f55b536a565b57531ac114461ae8736d6506a3",
  "expires_in": 43200,
  "user_id": 66748
}

So I need a way to get an access token, but I get this error right now:

Err(
    Error {
        kind: ExchangeFailure,
        source: Some(
            "TokenResponse token_type was missing or not a string",
        ),
    },
)

How can get around with this?

@jebrosen
Copy link
Owner

That's definitely frustrating.

https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1 states this about the token response:

access_token
REQUIRED. The access token issued by the authorization server.

Because it's REQUIRED, TokenResponse::token_type() can be defined to return &str. This could be changed, but it would require either:

  • Changing token_type() to return Option<&str> instead (breaking change)
  • Changing token_type() to return "" instead of returning an error (non-breaking change), and return an Option<&str> on a separate method to access the "real" value.

I'm unlikely to develop and test those changes on my own, but I would be inclined to accept a PR.

@jebrosen jebrosen added the noncompliant Issue is caused by a noncompliant provider label Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
noncompliant Issue is caused by a noncompliant provider
Projects
None yet
Development

No branches or pull requests

2 participants