Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.

401 Response Using Fresh Token

When I try using a Bearer token, I receive a 401 Unauthorized response.

This is what I'm doing:

  1. I make a POST request to https://1da287ac-xxxx-xxxx-xxxx-xxxxxxxxxxxx:****@example.cloud.panopto.eu/Panopto/oauth2/connect/token with a body of grant_type=client_credentials&scope=api
  2. Then I receive a Bearer token (say <TOKEN>).
  3. I use the token to make a GET request to https://example.cloud.panopto.eu/Panopto/api/v1/remoteRecorders/search?searchQuery=*. The token is sent in the Authorization header with Authorization: Bearer <TOKEN>
  4. The response code I receive is 401 Unauthorized and the response is
{ 
 "Error": { 
   "ErrorCode": "", 
   "Message": "User is not authenticated", 
   "Success": false, 
   "ErrorSource": null 
 } 
} 

At this point, I expected the response code not to be 401. Note that the failure is different if I include a wrong token, or if I make an invalid request by, for example, omitting the searchQuery parameter.

Is there something that I may be doing wrong?

Answers

  • Kevin BaumKevin Baum Panopto Employee

    Hi Ricardo,

    It looks like you are using a Sever Application client. Access tokens created for use with a Server Application client cannot be used to search for remote recorders since that feature requires user authorization, and a token retrieved using a Server Application client is not associated with any user. Server Application clients are currently only used in a very limited manner.

    Most of the calls to our REST API will require a user to be associated with the access token. Is your application running with a user present and able to log in, or is it intended to run as a service without a user directly interacting with the application?

    Thanks,

    Kevin

  • Hello Kevin,

    Thanks! That is correct, I am attempting to use a server application. The idea behind this is to enable automating scheduled recordings, which would occur at an organisation level and with minimal or no user interaction. User interaction might occur at some point (possibly outside Panopto), but the goal is that this will be a service.

  • Kevin BaumKevin Baum Panopto Employee

    Hi Ricardo,

    Thank you for the extra information. If you're not expecting any user interaction, you may want to look at using a User Based Server Application client. This type of client still requires a user's credentials, but allows you to send the credentials directly to the OAuth2 server, without the user needing to be present. There is some additional information in this support article (section 2.1).

    Please let me know if you have any other questions, or if you're still unable to get a working token.

    Thanks,

    Kevin

Sign In or Register to comment.