Forum Discussion

cike's avatar
cike
Champion
11 years ago
Solved

Authenticate technical user via REST API while SSO is enabled

Hey guys,

 

I'm using SSO to authenticate users within a community, but I also want to use technical users (non-SSO) to make requests via REST API. As I read here https://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?page=authentication it will be necessary to request the session key or sso authentication token before I can make other rest calls.

 

Which of them, session key or SSO authentication token, will be necessary for my use case (authenticate a technical user within a SSO-based community)?

 

Thanks and best regards,

Christian

  • cike

    Does your user have the API privileges?
    And are you sure about the password?

    Also make sure you don't have 2 users with the same username ...

5 Replies

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)
    11 years ago

    cike 

     

    For non SSO user, what worked for me was.

     

    1- get the token

     

    http://<url>/restapi/vc/authentication/sessions/login/?user.login=<yourNonSSOuser>&user.password=<yourpassword>

     

    2- then use the token returned by the first call (valid for 20 minutes) with the sso.authentication_token property


    http://<url>/restapi/vc/users/id/43/settings/?sso.authentication_token=<TokenReturnedEarlier>

     

    If it doesn't work for you, feel free to drop me a PM with your community / user details and I will give it a go

  • cike's avatar
    cike
    Champion
    11 years ago

    OlivierS 

     

    My current problem is that I don't get the token for the user's session. The request fails with error code 302 "User authentication failed".

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)
    11 years ago
    cike

    Does your user have the API privileges?
    And are you sure about the password?

    Also make sure you don't have 2 users with the same username ...
  • cike's avatar
    cike
    Champion
    11 years ago

    @OliverS

     

    API privileges and password are correct, but it seems the username is already used by another user.

    I changed the username for the service account and now I get the session key and can go further.

     

    Thanks and best regards,

    Christian