Mahyar Zarifkar
Mahyar Zarifkar

Reputation: 196

Validating OAuth2 token in WSO2

I want to use WSO2 for sso. When i'm going to validate token code in SoapUI i'm facing with Invalid access token error. I registered and i'm redirect to this URL:

http://MyRedirectPage/?code=63873a38-40c6-3240-850c-a50bf7ad8883&session_state=7877d1d733d534206c4247b31d63d95bd3e3dda9d77cd819b4d81e7eeabceb45.Xq6OQiFUARHShBxUZtFHTQ

I'm using code parameter for validation: 63873a38-40c6-3240-850c-a50bf7ad8883

Here is my code in SoapUI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://dto.oauth2.identity.carbon.wso2.org/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:validate>
         <!--Optional:-->
         <xsd:validationReqDTO>
            <!--Optional:-->
            <xsd1:accessToken>
               <!--Optional:-->
               <xsd1:identifier>63873a38-40c6-3240-850c-a50bf7ad8883</xsd1:identifier>
               <!--Optional:-->
               <xsd1:tokenType>Bearer</xsd1:tokenType>
            </xsd1:accessToken>
            <!--Zero or more repetitions:-->
            <xsd1:context>
               <!--Optional:-->
               <xsd1:key>?</xsd1:key>
               <!--Optional:-->
               <xsd1:value>?</xsd1:value>
            </xsd1:context>
            <!--Zero or more repetitions:-->
            <xsd1:requiredClaimURIs>?</xsd1:requiredClaimURIs>
         </xsd:validationReqDTO>
      </xsd:validate>
   </soapenv:Body>
</soapenv:Envelope>

And here is the result:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:validateResponse xmlns:ns="http://org.apache.axis2/xsd">
         <ns:return xsi:type="ax2395:OAuth2TokenValidationResponseDTO" xmlns:ax2395="http://dto.oauth2.identity.carbon.wso2.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ax2395:authorizationContextToken xsi:nil="true"/>
            <ax2395:authorizedUser xsi:nil="true"/>
            <ax2395:errorMsg>Invalid access token</ax2395:errorMsg>
            <ax2395:expiryTime>0</ax2395:expiryTime>
            <ax2395:scope xsi:nil="true"/>
            <ax2395:valid>false</ax2395:valid>
         </ns:return>
      </ns:validateResponse>
   </soapenv:Body>
</soapenv:Envelope>

Would you please tell me what is wrong?

Upvotes: 0

Views: 139

Answers (1)

Bee
Bee

Reputation: 12502

It seems you're trying to validate the authorization code. (Why are you doing that?) This service is only for validating access tokens.

Upvotes: 1

Related Questions