Problem with Oauth Password Grant Type

Hello,

I’m trying to complete a POC securing an api with OAuth 2.0 (Password Grant Type) but I can’t complete it.

I’m following this guide I found in the community:
https://docs.google.com/document/u/1/d/17Eon4K1QQ6-2xl0BXft2k8WYsL7KJkS2duCYje88WVA/pub#h.iwol31aw4x25

The problem is that I can’t create a key through the dashboard that allows me to associate a username and password to the key, for my OAuth api.

If, when trying to create a key, I select an api of the “Basic Auth” type, an “Authentication” tab appears that allows me to enter a username/password. But when selecting my OAuth api (Password Grant type) the tab disappears.

I have also tried to check the api to create the key via postman but it is very confusing for me.

Any idea why it’s not possible to create the key this way?

Thanks and regards

With a “Basic auth” api you can see the tab

But when selecting the OAuth Password Grant Type api, the tab disappears

You are correct but the doc itself is a bit old. The UI in the docs is a version 2 of the gateway.

I know the authentication tab only shows for a basic auth type in newer versions, so I will find out more information internally and update this thread.

In the meantime, you can workaround the UI issue by using the Dashboard REST APIs. Creating a custom key with the username ([email protected]) as the custom-key-id should suffice. I have added a snippet below

POST /api/keys/[email protected] HTTP/1.1
Host: localhost:7080
Authorization: 0c4471a636134ca76f9ab5c16a5f7d8a
Content-Type: application/json

{
	"access_rights": {},
	"alias": "[email protected]",
	"allowance": 0,
	"apply_policies": [
		"{{oauth_policy_id}}"
	],
	"apply_policy_id": "",
        "basic_auth_data": {
		"password": "1234567",
		"hash_type": "bcrypt"
	},
	"expires": 0,
	"per": 0,
	"quota_max": 0,
	"rate": 0
}