Search code examples
wso2wso2-api-managerwso2-identity-server

change Authorization path in WSO2 API


the applications have to use the default authorization path "https://localhost:9443/oauth2/token" to get access token. However I need to change this URL to "http://localhost:8280/token"

How can I change the Authorization path in WSO2 API-Manager??


Solution

  • You can do this as follows.

    1. Create a file called _token.xml in APIM_HOME/repository/deployment/server/synapse-configs/default/api.

    2. Add the content below to the _token.xml file.

    <api xmlns="http://ws.apache.org/ns/synapse" name="_WSO2AMTokenAPI_" context="/token">
        <resource methods="POST" url-mapping="/*" faultSequence="_token_fault_">
            <inSequence>
                
                <send>
                    <endpoint>
                         <http uri-template="https://localhost:9443/oauth2/token">
                            <timeout>
                                <duration>60000</duration>
                                <responseAction>fault</responseAction>
                            </timeout>
                        </http>
                    </endpoint>
                </send>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </resource>
        <handlers>
            <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerCacheExtensionHandler"/>
            <handler class="org.wso2.carbon.apimgt.gateway.handlers.common.SynapsePropertiesHandler"/>
        </handlers>
    </api>
    
    1. Add the following configuration to the deployment.toml file repository/conf folder.

    [apim.sync_runtime_artifacts.gateway.skip_list]
    apis = ["_token.xml"]

    Note: Add this configuration value after the config value [apim.sync_runtime_artifacts.gateway].

    1. Start/Restart the server