Search code examples
wso2wso2-api-manager

How to create OAuth2 Opaque(Reference) Access Tokens


How to create OAuth2 Opaque(Reference) Access Tokens in apimanager 410? I followed enter link description here, but cannot find OAUTH token type when we create applications.

I want to create this application because of the issue enter link description here. if same token is sent every time we call the token api, this will work for us. Our tests need to get the token first and use it from there. there can be different apis calling in different times and this will expire the first token.

enter image description here


Solution

  • There is a lengthy manual method that lets you to create opaque tokens in APIM 4.1.0, but our recommendation is to proceed with the JWT token-based applications. This will reduce the load at the gateway with token validation which is a huge performance gain. Even if you used the same clientID, or secret Pair, you can change the scopes set with a device scope and I believe this should give you the ability to create multiple tokens at the same time.

    Having said that, you can create opaque token in the below approach, but this will remove the user experience provided in the devportal and you have to use carbon console(https://localhost:9443/carbon) if you need to change your application.

    1. log in to admin portal (https://localhost:9443/admin)
    2. Open Key managers --> resident key manager (or whatever the key manager you have) --> and select Out Of Band Provisioning and save. enter image description here
    3. Log in to carbon console (https://localhost:9443/carabon)
    4. Register a service provider. enter image description here
    5. Under Inbound authentication config, select OAuth/OpenID connect configurations and configure an OAuth Applicaitonenter image description here
    6. Add you application details from here as you prefer with the listed grant types and create an application.
    7. Make sure to select the token issuer and default. This is where you select whether the token type is JWT or Opaque. enter image description here
    8. Once you save it, you can find the client ID secret pair in here. enter image description here
    9. Log in to devportal (https://localhost:9443/devportal)
    10. Create an application.
    11. Under the production Keys section, now you can see a new option enabled as provide existing OAuth keys. enter image description here
    12. Add the consumer key secret pair you created in the step 8.
    13. Now you have created an application that generates opaque tokens.