I recently wrote a Pushbullet Linux command line client in Bash. I want to allow users to grant access to their Pushbullet accounts via Oauth, but I'm having some trouble. I just did Oauth for Google Drive API the other day. It was fairly straightforward, requiring just a few lines of code. To be honest, the Oauth section in the Pushbullet API docs is somewhat unclear.
Let me make sure I understand the steps required:
- Send user to Pushbullet site with URL generated in-app
- URL should include: client_id and redirect_url (redirect_url specifies the url a user is re-directed to after granting access to Pushbullet, in addition to response_type, either token or code)
- User grants or denies access to their Pushbullet account
- If access is granted, user is sent to redirect_url
- Client must obtain the access_token embedded in the redirect_url and then append access_token to all future requests
Does that sound about right?
My script successfully loads the authentication URL in my browser, but when I click "approve" I get the following error: The param 'redirect_uri' has an invalid value
. I used the redirect_uri listed in the "clients" section of the Pushbullet settings. So, this:
https://www.pushbullet.com/login-success/access_token=<access token>&response_type=token&scope=everything
Am I using the correct url? This is a command-line client, and I don't have a domain for it. That shouldn't matter, though, right?
Does Oauth always require authentication via browser, or can it be done via some kind of web service call (this is how GDrive API seems to work)? Ideally, I would have curl handle everything, rather than having to worry about loading web browsers.