Forum Discussion

vmalla's avatar
vmalla
Adept
7 years ago

Invalid Cross-Origin Request when trying to retrieve Session Key

Hi,

 

I'm trying to retrieve session key as per https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=sessionauth

 

I was trying this using postman client(for testing).

 

<response status="error">
<error code="307">
<message>
Invalid Cross-Origin Request. Request origin: &apos;chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop&apos; contains no matching allowed origin(s).
</message>
</error>
</response>

 

My aim is to write a set of API extractors to retrieve the data from lithium community via API.

 

 

 

  • vmalla - Can you try to hit Get request and passing the user.login and password on URL? 

     

    /vc/authentication/sessions/login?user.login=login&user.password=pwd

    • vmalla's avatar
      vmalla
      Adept

      Hi,

       

      Thanks for quick reply.

      I've tried as you suggested. I'm getting below error.

       

      <response status="error">
      <error code="302">
      <message>
      User authentication failed.
      </message>
      </error>
      </response>

      • vmalla - 

         

        Below is postman collection file. Save this file as .json and import it on POSTMAN tool.  After importing the file just update the URL and credentials. 

         

        {
        	"variables": [],
        	"info": {
        		"name": "DEMO TEST",
        		"_postman_id": "e2e70e34-333c-7fd3-59a1-9489427af7de",
        		"description": "",
        		"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
        	},
        	"item": [
        		{
        			"name": "API0AuthV1",
        			"request": {
        				"url": {
        					"raw": "https://community.url/restapi/vc/authentication/sessions/login?user.login=USERNAME&user.password=PASSWORD",
        					"protocol": "https",
        					"host": [
        						"community",
        						"demo",
        						"com"
        					],
        					"path": [
        						"restapi",
        						"vc",
        						"authentication",
        						"sessions",
        						"login"
        					],
        					"query": [
        						{
        							"key": "user.login",
        							"value": "USERNAME",
        							"equals": true,
        							"description": ""
        						},
        						{
        							"key": "user.password",
        							"value": "PASSWORD!",
        							"equals": true,
        							"description": ""
        						}
        					],
        					"variable": []
        				},
        				"method": "GET",
        				"body": {},
        				"description": ""
        			},
        			"response": []
        		}
        	]
        }