Forum Discussion

ldavid's avatar
ldavid
Contributor
11 hours ago

Session Key auth 302 Failure

Hello!

Apologies in advance if this has been asked, I am very new to the library. I am unfortunately stuck on logging in to acquire a session token (following Session Key authentication) for a while now.

I have an account which is given API access by the company, but when trying to login with the session API key, I get 302 user authentication failed. I am confident that my username/password combination is correct, and that this is not an issue with escaping (also wrote a Python client to verify, got the same results):

user@HOSTNAME:~$ curl --location --request \
> POST 'https://[community]/restapi/vc/authentication/sessions/login' \
> --form 'user.login=[username]' \
> --form 'user.password=[password]'
<response status="error">
  <error code="302">
    <message>
      User authentication failed.
    </message>
  </error>
</response>

Of note perhaps, is that when I login to my community I am redirected to the company SSO; the domain itself does not provide login portals; perhaps this is a clue? I'm not sure if this circumstance allows for session authentication. It's confusing me because coworkers have reported being able to execute the curl command and login. I also tested with an admin-provisioned API-key user account, with the same results.

What are the circumstances under which 302 authentication failure is triggered, assuming username/password and API permissions are supposedly granted? I've scanned the community for related posts, but the status code for authentication issues is not often 302. Is this an IP whitelisting issue, or do I need extra headers, or am I just not allowed to make session auths? Would appreciate any help on resolving this issue.

1 Reply

  • Just confirming - your user has "Make REST API V1 calls with read access" permission? And they were created via the admin console with a username & password? You might consider temporarily making the user a full admin just to make sure it's not a permissions issue.

    But TBH it seems like something with your SSO? I'm afraid I can't help there but hopefully someone else here can!