3

I'm in the process of applying swagger to a project of mine.

In terms of Authorization, the user can log in with email and password and they'll get an authorization token.

They're then supposed to send this token along with every call, in the header.

So it would be like: MyAuthorization: authKey

Looking at the swagger documentation, it seems that it is only set up to handle OAuth. Is there a way to have swagger handle the authentication my way? I mean in the generated code. I can generate code for the project, it just only has "Basic: ..." as an option.

I'm running swagger 1.3.6, can't upgrade due to dependencies.

1 Answer 1

3

From the Swagger 1.2 specs

You can define an authorization object which specifies you are using

  • a type of "apiKey"
  • a passAs of "header", to indicate the key is passed in the request header
  • a keyname of "MyAuthorization", or whatever your header is
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.