Getting access token


#1

Hi,

I have managed to send a message to a conversation thru the API using a conversation access token, but I can’t send a message to a user.

I’m guessing I need to request an access token but when I attempt that I get the following:

{"client_id":"xxxxxxx","client_secret":"xxxxxxx","grant_type":"client_credentials"}
{"error":"access_denied","error_description":"Client is not authorized to access 

Any help or direction would be greatly appreciated.

I deleted the rest of the request and response details as a new user it would not let include the links…

Thanks,
DaveS


#2

Hi Dave,

Yes, it is a known issue: https://jira.atlassian.com/browse/STRIDE-965

We’re currently testing a fix in our staging environment.

Cheers,
Tanguy


#3

Hi again,

Something else to consider: are you trying to use a token which you’ve generated from the Stride UI (Connect your own app / API tokens)?

If so, you should note that tokens generated this way only work within the context of the room they’ve been created in.

If you want to be able to send messages to multiple rooms, and send direct messages to end users, you’ll have to build an app. The easiest way to get started is to follow our Getting started guide.

Please note that the bug mentioned in the previous message still applies though.

Cheers,
Tanguy


#4

I have created a .net application that is trying to send a message to a user.

I suspected that I could not use the token generated for the app and room could not be used to send a message to a user.

So I attempted to obtain a access token by:

POST https://api.atlassian.com/oauth/token HTTP/1.1
Content-Type: application/json
Host: api.atlassian.com
Content-Length: 165
Expect: 100-continue
Connection: Keep-Alive
 
{"client_id":"xxxxxx","client_secret":"xxxxx","grant_type":"client_credentials"}

Can you tell me what I’m doing wrong?

Thanks,
DaveS


#5

Response:

HTTP/1.1 403
Vary: Accept-Encoding
ATL-vTM-Backend-Time: 149
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
X-Cache: Error from cloudfront
Content-Type: application/json
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
Date: Tue, 16 Jan 2018 15:17:26 GMT
X-Auth0-RequestId: 65e74607ca4df70423b1
X-RateLimit-Limit: 1000
X-RateLimit-Reset: 1516115847
X-Application-Context: Stargate:prod,prod-east:8080
X-XSS-Protection: 1; mode=block
transfer-encoding: chunked
ATL-vTM-Time: 626
X-Content-Type-Options: nosniff
Via: 1.1 de390f2a4c2c110d009e8b1fc0fb9346.cloudfront.net (CloudFront)
Connection: keep-alive
X-Amz-Cf-Id: jQhzpvzS3zdSPEFdWtJPqbOIyDApS34ybLKxS08lg6KX8E5b9fPjew==
X-Frame-Options: SameOrigin
X-RateLimit-Remaining: 1000
ATL-vTM-Queue-Time: 0

fc
{“error”:“access_denied”,“error_description”:"Client is not authorized to access “api.atlassian.com”. You might probably want to create a “client-grant” associated to this API. See:…
0


#6

Yes: your app must be installed in a conversation (any conversation) first.
You should maybe try the getting started guide (step by step) and then reproduce with your app.


#7

Thank you…I went back thru the installation process. It works now.

I had not used the installation url to connect to a conversation. I thought it had to do with add-on (bot?) apps. My app will not actually be in stride but send messages from an ERP system to a user thru the StrideAPI.

I see I still need to mention the app for it to work.


#8

OK what we call an “app” is what you’re currently building that either sits between the ERP system and Stride, or in the ERP system itself.

You don’t need to make it a bot: an app can send a direct message to a user without having a bot. Having a bot means that users can reply back, or mention the user in messages.

We’ve just rolled out a fix to the bug I mentioned earlier: so please follow instructions from here: Fixed: sending a message to a user
And you should be able to send direct messages to any user, without the user having to mention the app first.


#9

hello tcrusson

I was reading this document, https://developer.atlassian.com/cloud/stride/tutorials/how-to-get-started-using-the-stride-rest-api-with-postman-using-oauth2-2lo-tokens/#token-expiration, but I have a question, how can I send messages with oauth 2.0? , I’m new using stride


#10

@jorgeality94,
OAuth2 has two authentication pathways. 2-legged OAuth (2LO) and 3-legged OAuth (3LO).

2LO is for authorizing between a client and server, your App being the client and Stride API being the Server.

3LO is for authorizing a client, your App, to interact with a server on behalf of a user.

We currently support 2LO, and are actively developing 3LO support. Is 3LO what you’re asking about?