Friendly OAuth2 Server
Sign Up Sign In
Index Documentation Download Check license
Friendly oAuth2 server documentation
Friendly oAuth2 server documentation
Setup and running
Setup and running test version
Setup and running production version
Setup https protocol
Setup other database
Working with OAuth2 and OpenId Methods
OAuth2
OAuth2 code flow
OAuth2 implicit flow
OAuth2 user password flow
OAuth2 client credential flow
OAuth2 refresh token flow
OpenId
OpenId code flow
OpenId implicit flow
Client secret authentication
Client secret basic
Client secret post
Client secret jwt
Client key jwt
None
Extra
OAuth2 dynamic registration
OAuth2 revoke
OAuth2 introspect
OAuth2 jwks.json
OAuth2 .well-known
OAuth2 backchannel_logout
OAuth2 userinfo
Extra settings
Control panel
User section
User sessions 1
User sessions 2
User info
Change password
Delete account
Client section
List of registered clients
Number of authorizations per day
New client registration
Admin section
Client authorizations
Auth settings
Users
Clients
Administrators
Roles
Limits
Create user
Authorization OAuth2 client credential
General description of actions for authorization OAuth2 client credential
In this authorization method, the token is issued only to the client application without being tied to the user. 1) The client application submits a POST request to the server with the following data: 1.1) Options: grant_type = client_credentials — authorization type 1.2) Headers: Content-Type = application/x-www-form-urlencoded — request body type Plus, client authorization is required, for example, you can select the BASIC type: Authorization = Basic aWQtalU4NXNoTnNqVUlpWGQ2MDJhTXhtVjFqSmlPTUdSSko3ZHJHeTRCSGlFZEN0SVk6UWNxUVl0OExRWVVEbDdtMk1KOVNFNkFxYklKOE9MWHdnNkJTSVRnTEFjMHpKcXBRY3I= — соединяем через двоеточие client_id:client_secret — and encode the resulting string into BASE64 format Example request in cUrl:
curl --request POST \ --url http://localhost:9000/oauth2/token \ --header 'Authorization: Basic aWQtalU4NXNoTnNqVUlpWGQ2MDJhTXhtVjFqSmlPTUdSSko3ZHJHeTRCSGlFZEN0SVk6UWNxUVl0OExRWVVEbDdtMk1KOVNFNkFxYklKOE9MWHdnNkJTSVRnTEFjMHpKcXBRY3I=' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data grant_type=client_credentials
2) The server outputs the value in JSON format with parameters: access_token — access token token_type = Bearer — token type expires_in — access token expiration time in milliseconds Sample response:
{ "access_token": "GpZfo3gZfd2OH1ml9ApeAJ1MTzE31sNZqGtLHj1uegRbABtpPFfZlJz3Gst4h9BJCqbPngYzISueaXVQ7yWlGz6GJZ9GmHpRfxNmmMAev9MJ2RduZFzDjIlkCl9VrREZr9ONKyCOJsZXP8R6dZRWdsUJpmsFmASt9JdhUp8JbSlg4z3HaIr91I3tIR76MrI0Xa9feJrh9kEpSSyaUgfcow9uFRIHiYnybDTlBxF1jtuZrv8Wl0j5Z4RRYN4taEP", "token_type": "Bearer", "expires_in": 1718080836 }
Practical example of OAuth2 client credential authorization
0) Be sure to check that the authentication settings are set to OAuth2 client credential flow
Otherwise, authorization with the code will not work. Also, make sure that option Client secret basic is selected in the Client Authorization block. After setting this parameter, do not forget to click on the save button.
1) Let's create a new client application in the admin panel
2) Let's find him in the list of registered clients
3) Let's send a POST request to the authorization server using the http://localhost:9000/oauth2/token link
Here we get the access token for the client application.
Friendly OAuth2 Server
prodmicroservice.com
2024