golang/oauth2

No way to check if server supports UserInfo

crawshaw opened this issue · 1 comments

The server's .well-known/openid-configuration reports a UserInfo endpoint which is used in the UserInfo method. If the OIDC provider does not report an endpoint, UserInfo reports an error. But there is no way programmatically check beforehand and no way to check the error message other than string matching:

ui, err = provider.UserInfo(ctx, source)
if !strings.Contains(err.Error(), "user info endpoint is not supported") {
        // handle it
}

It would be nice if it were possible to avoid string matching on the error. Perhaps either something to pass to errors.Is or a mechanism for inspecting the contents of the .well-known/openid-configuration that the oauth2 package fetched?

Turns out this error comes from another package. Sorry for the noise, filed elsewhere: coreos/go-oidc#373