Example of working with OAuth2 in an API Platform #30
cweinschenk
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
NERIS uses OAuth2 for integration authentication. If you are using the
/tokenendpoint, which is what the OAuth2 uses under the hood to authenticate clients and users, thegrant_typemust be in the Body and theclient_idandclient_secretmust passed in as a Basic Auth header. To do this, remove the URL params and then move thegrant_typeto the Body section:Next, add the client credentials into the Basic Auth header. To do this, change the Auth Type to Basic Auth and then put in your
client_idin the Username field and theclient_secretinto the Password field:This will return an access token that can be used in subsequent requests to the NERIS API, until that token expires. To use that token you will need to pass it in the Authorization header with the Auth Type as Bearer:
You can also set up the OAuth2 Authorization in an API platform tool like Postman, which will automatically call the
/tokenendpoint and fetch and set theaccessToken. However, you can only do this for endpoints that are not/tokenand endpoints that you have authorization to access. Here is an example of that using the List Entities endpoint:Beta Was this translation helpful? Give feedback.
All reactions