Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Access Token #19

Open
PEScorp opened this issue Feb 4, 2019 · 11 comments
Open

Invalid Access Token #19

PEScorp opened this issue Feb 4, 2019 · 11 comments

Comments

@PEScorp
Copy link

PEScorp commented Feb 4, 2019

Hi Everyone,

I have issue regarding in Access token , I already use my access token but after the next day ,It response Invalid Access Token,

Can anyone help me regarding this matter,

Thanks

@patrickjeried
Copy link

I'm having the same issue.

Screen Shot 2019-09-18 at 3 00 43 PM

@wmjuat
Copy link

wmjuat commented Sep 25, 2019

What access token are you using?

@kawoki
Copy link

kawoki commented Sep 21, 2021

Just found out why it returns Invalid access token. The problem was, you MUST use the recipient's access token for the POST request. For example:

# Request URL
https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/<short code>/requests?access_token=<recipient's access token>

# Request Body
{
    "outboundSMSMessageRequest": {
        "senderAddress": "1234",  // short code suffix
        "outboundSMSTextMessage": {
            "message": "Your message goes here"
        },
        "address": "9071234567" // the recipient
    }
}

At the end of the day, the recipient NEEDS to register to your app.

There's an instruction below your app in Globe Labs

  • Go to My Apps
  • select your app
  • scroll down to see the instructions

Hope this helps.

@greenlover1991
Copy link

greenlover1991 commented Dec 23, 2021

Just found out why it returns Invalid access token. The problem was, you MUST use the recipient's access token for the POST request. For example:

# Request URL
https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/<short code>/requests?access_token=<recipient's access token>

# Request Body
{
    "outboundSMSMessageRequest": {
        "senderAddress": "1234",  // short code suffix
        "outboundSMSTextMessage": {
            "message": "Your message goes here"
        },
        "address": "9071234567" // the recipient
    }
}

At the end of the day, the recipient NEEDS to register to your app.

There's an instruction below your app in Globe Labs

  • Go to My Apps
  • select your app
  • scroll down to see the instructions

Hope this helps.

Hi, @kawoki I'm still getting Invalid access token even with access_token for that subscriber. How did you fix yours?

Steps I did:

  1. Let user register via the dialog https://developer.globelabs.com.ph/dialog/oauth/<app_id>
  2. After user received confirmation code and inputted code, your callback will receive the code as a query parameter via GET
  3. Retrieve access_token for that subscriber: curl -X POST -d 'app_id=<app_id>' -d 'app_secret=<app_secret>' -d 'code=<code in step 2>' https://developer.globelabs.com.ph/oauth/access_token. This returned: {"access_token":"<subscriber's access_token>","subscriber_number":"9123456789"}
  4. Send SMS to that subscriber: curl -H "Content-Type: application/json" -d '{"outboundSMSMessageRequest":{"outboundSMSTextMessage":{"message":"hello world"},"address":"9123456789", "senderAddress":"1234"}}' https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/<short code>/requests?access_token=<subscriber's access_token>
  5. [BUG] got error {"error":"Invalid access token"}

@kawoki
Copy link

kawoki commented Jan 13, 2022

@greenlover1991, Try using your short code in senderAddress instead of 1234

@greenlover1991
Copy link

greenlover1991, Try using your short code in senderAddress instead of 1234

@kawoki yup, used my short code instead of 1234, still got the same error

@kawoki
Copy link

kawoki commented Jan 21, 2022

@greenlover1991, not quite sure what causes your error. Try Postman for testing api request instead of curl. It is easier than doing everything in the terminal.

@markandrewkato
Copy link

@greenlover1991 did you manage to fix your issue? I'm also getting the same issue but I entered the correct access token and sender address data which is the last 4 digit of shortcode

@greenlover1991
Copy link

@markandrewkato no. I gave up. Better to use a different SMS API gateway.

@mcandidier
Copy link

having the same problem, @markandrewkato any luck with this issue?

@pavithramm
Copy link

Having the same problem . any updates on the fix ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants