Skip to content

Commit 5a6424d

Browse files
Merge pull request #6 from mgagliardo91/patch-auth-url
fix(auth): Cache as authorize_url and respect relative server urls
2 parents f254e92 + d895bf9 commit 5a6424d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

oauth/authcode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ type AuthorizationCodeHandler struct{}
154154
func (h *AuthorizationCodeHandler) Parameters() []cli.AuthParam {
155155
return []cli.AuthParam{
156156
{Name: "client_id", Required: true, Help: "OAuth 2.0 Client ID"},
157-
{Name: "authorization_url", Required: true, Help: "OAuth 2.0 authorization URL, e.g. https://api.example.com/oauth/authorize"},
157+
{Name: "authorize_url", Required: true, Help: "OAuth 2.0 authorization URL, e.g. https://api.example.com/oauth/authorize"},
158158
{Name: "token_url", Required: true, Help: "OAuth 2.0 token URL, e.g. https://api.example.com/oauth/token"},
159159
{Name: "scopes", Help: "Optional scopes to request in the token"},
160160
}

openapi/openapi.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ func loadOpenAPI3(cfg Resolver, cmd *cobra.Command, location *url.URL, resp *htt
345345
basePath := ""
346346
prefix := location.Scheme + "://" + location.Host
347347
for _, s := range swagger.Servers {
348-
if strings.HasPrefix(s.URL, prefix) {
348+
if strings.HasPrefix(s.URL, "/") {
349+
basePath = s.URL
350+
} else if strings.HasPrefix(s.URL, prefix) {
349351
base, err := url.Parse(s.URL)
350352
if err != nil {
351353
return cli.API{}, err

0 commit comments

Comments
 (0)