swagger: "2.0" info: version: "v1.1" title: "MTN MADAPI OAuth2" description: "Generates an access token based on username and password." # == Cannot declare support for multiple Content-Types in Swagger 2.0 - formData vs Body parameter clash. # == Cannot differentiate between example and default values in formData parameters. # == Commented out sections for possible later use # == Apigee policy also restricts (hence building reformat support) :- # == The only valid location that you can set is the default location, the flow variable request.formparam.client_id contact: name: "MTN API Support" email: "developer-support@mtn.com" host: "api.mtn.com" basePath: "/v1/oauth" schemes: - "https" consumes: - "application/x-www-form-urlencoded" # - "application/json" produces: - "application/json" paths: "/access_token": post: tags: - Get access token summary: "Endpoint to request an access token for use in subsequent api calls that require a bearer token in the authorization header." description: "OAuth2 endpoint that provides an access token for consumers of other endpoints." parameters: - name: grant_type type: string in: query description: "Type of grant i.e client credentials" enum: ["client_credentials"] required: true # - name: Content-Type # type: string # in: header # description: "Content type of body parameters" # enum: ["application/x-www-form-urlencoded", "application/json"] # required: true - name: "client_id" in : formData description: "The client identifier / username." type: string # default: "FqEqUWvFBV80x4R4vt4Am7cuTyspnVVN" - name: "client_secret" in: formData description: "The client secret / password." type: string # default: "fWV2MG9Xc4OYlea0" # - name: body # in: body # description: "Request body" # required: true # schema: # type: object # properties: # client_id: # description: "The client identifier / username." # type: string # default: "xxxxx" # example: "FqEqUWvFBV80x4R4vt4Am7cuTyspnVVN" # client_secret: # description: "The client secret / password." # type: string # default: "yyyyy" # example: "fWV2MG9Xc4OYlea0" responses: 200: description: Successful token generation. schema: $ref: "#/definitions/SuccessToken" 401: description: "Unauthorized" schema: $ref: "#/definitions/Unauthorized" 400: description: "Bad Request" schema: $ref: "#/definitions/BadRequest" definitions: SuccessToken: type: object properties: access_token: description: "Temporary access token generated by auth API" type: string example: "Q3C3dhzGxB4I8AZJ6ldPxuSB3Y6o" token_type: description: "The generated access token type" type: string example: "bearer" expires_in: description: "Expiry time for the generated token." type: string example: "3599" refresh_token_expires_in: description: "N/A" type: string api_product_list: description: "N/A" type: string api_product_list_json: description: "N/A" type: string organization_name: description: "N/A" type: string developer.email: description: "N/A" type: string issued_at: description: "N/A" type: string client_id: description: "N/A" type: string application_name: description: "N/A" type: string scope: description: "N/A" type: string refresh_count: description: "N/A" type: string status: description: "N/A" type: string Unauthorized: type: object properties: error: type: string example: 'invalid_client' BadRequest: type: object properties: error: type: string example: 'unsupported_grant_type'