Expand my Community achievements bar.

Workfront API Authentication Error "You are not currently logged in." while trying to access via Postman

Avatar

Level 1

Hello all,
I'm trying to use Workfront APIs but it keeps throwing the following authentication error. "You are not currently logged in."
Note: I am using it in a sandbox environment with a system admin user. API version 15.0
From what I have understood from the documentation, there are 2 ways for authentication.
1. SessionId - I tried using the login API to obtain a sessionId. I used the below mentioned URL for a POST call.
https://mysandboxdomain.my.workfront.com/attask/api/v15.0/login?username=useremail&password=userpassword
Unfortunately, it keeps giving me the unauthorized error. I even tried using url encoding for my credentials as they have some special characters but that doesn't seem to work either 
2. API Key - I tried using the project API with an API key that I generated from the sandbox instance but that didn't work either. Below is the URL I used for a GET call.
https://mysandboxdomain.my.workfront.com/attask/api/v15.0/project/projectSpecificURI?apiKey=apikeyGeneratedFromTheSandbox
I tried by using a newly generated API key but none of that seems to work.
Note: The project API works perfectly from the browser when I'm logged in to the instance

8 Replies

Avatar

Community Advisor

Hi, Here's how mine is set up:

In Environments I have Preview and Production with all the parameters in the screenshot

In collections, I have some hierarchical folders set up with some different types of API calls

I have 3 top tier folders where the Authorisation is defined as "apikey"

I have subfolders where the Authorization is set to "Inherit from Parent"

Each level of the hierarchy will inherit its auth from its parent until it gets to the top tier where it will use the "apikey"

in each API call I use the global {{base_url}} and {{apikey}} to pull from the environment I'm in at the moment. This way you can switch from Preview to Sandbox to Production without changing any of your API calls.

See screenshots:
ScreenShot 2024-10-18 at 1.32.30 PM.jpgScreenShot 2024-10-18 at 1.33.27 PM.jpgScreenShot 2024-10-18 at 1.43.10 PM.jpgScreenShot 2024-10-18 at 1.40.34 PM.jpgScreenShot 2024-10-18 at 1.40.45 PM.jpg

 

TIP: if this solved your problem, I invite you to consider marking it as a Correct Answer to help others who might also find it of use.
If you like my content, please take a moment to view and vote on my Idea Requests: https://tinyurl.com/mysocalledideas

 

Avatar

Level 1

Hi @RandyRoberts, thanks for replying. I'm working on this workfront API collection that I found online which has a very similar setup to that of yours. I have attached a few screenshots, can you please help me figure out what I'm missing
Top most folder:

AnirudhKa_0-1729492900978.png

Parent folder: 

AnirudhKa_1-1729492988597.png

API request:

AnirudhKa_2-1729493127050.pngAnirudhKa_3-1729493219558.png

 

Avatar

Community Advisor

I can only go off what you're showing me... so to break it down:

 

1) I use option 2.

2) https://mysandboxdomain.my.workfront.com -- this isn't the right address for a sandbox. The word "my" would never show up there.

3) /project/projectSpecificURI? -- not sure what this is exactly, but I would go with /proj/search?ID=67847382648238427 (assuming you're searching for a project using their GUID?)

Avatar

Level 1

Hello, thanks for replying @skyehansen , https://mysandboxdomain.my.workfront.com is just a placeholder that I have used in this post. I'm pretty sure that I'm using the correct domain name as I copied it from the "setup > system > customer info" as shown in the documentation. 
About the projects API, I'm using the project GET API and not the search API. Here is a reference to it. Also, "projectSpecificURI" is just a placeholder term, sorry about the placeholder confusion. Anything else you think I'm missing?

AnirudhKa_0-1729493916418.png

 

Avatar

Community Advisor

I'm looking at your screenshots you sent to Randy. In your screenshots for the API request, you're showing no environment selected (upper right corner)? You also haven't provided any screenshots showing how your environment was set up -- did you create one (per his first screenshot)? If you did, can you show it like he did, with the info blanked out?

Avatar

Level 1

Hi @skyehansen , I haven't set up an environment, I have added all the variables to the collection level instead. I'm sure that all the variables are flowing correctly to the API request, I checked that by clicking the code option and making sure that the variables are flowing as expected. Do you think adding an environment will make a difference?

AnirudhKa_0-1729605370064.png

 

Avatar

Community Advisor

To answer your question: I definitely have an environment on mine. So I think this is something you can test? Randy and I both have environments set up as a matter of course and this is just how we work and what we're most familiar with.

 

Since there are a lot of screenshots going on right now, it's difficult to say what's best to do. I know at the very beginning you mentioned that you were setting up in a sandbox. I'm still not convinced that your base URL is correct -- I totally understand that you are not willing to share URLs with the wider community but are you at least able to submit a case to the Support team, and have them confirm that your URL is correct for the sandbox your API key resides in? Are you an authorized contact for Support?

 

Additionally -- since your problem is with the authentication part, I was hoping we can look at a more simple collection and call, than all the ones you are choosing to start on? Something like "search for an issue", is a really basic search that you can use to test the authorization piece. With the base call being:

{{Base_URL}}attask/api/{{API_Version}}/optask/search

i.e. just uncheck all the boxes -- you should be able to send this and get a result.

Avatar

Level 1

Hi @skyehansen , I took your suggestion and created an environment still no luck. I'm sure about the base_url being correct coz I get a valid response when I hit it from the browser. I'll attach the necessary screenshots for your reference.

AnirudhKa_0-1729665968182.pngAnirudhKa_1-1729666017114.pngAnirudhKa_2-1729666112986.pngAnirudhKa_3-1729666223779.png

I think contacting the support team now after all the trail errors is a good idea. I'll go ahead and do that. Thank you @skyehansen