iosswiftoauth-2.0paw-app

Paw Authentication Token Issue


I just starting working on an iOS Swift 3 application that will integrate with a certain EHR. I had it working several months ago, but when I tried it this eve I noticed the application froze when I tried to get the access token. it appears that the token part of the OAuth2 exchange has changed and now looks like this:

POST https://api.xxxxxx.com/oauth2/access_token

curl -X POST https://api.xxxxxx.com/oauth2/access_token \ -H 'Authorization: Basic Y2xpZW50X2lkOnNlY3JldA==' \ //dummy auth --data "code=a14d2c8e-9c8a-4820-8ae1-d9313bb6abe2&grant_type=authorization_code&redirect_uri=YOUR_REDIRECT_URI" //dummy code

I was going to include a pic of their documentation concerning this, but its copyrighted. Basically this is what must be included in the post to the token URL:

The Authorization header is required and must be in the format API_KEY:SECRET_KEY and then url safe base64 encoded. The body of the request must include the following fields: code - The authorization code that was sent to your Redirect URI at the end of the OAuth login process (see above). grant_type - The type of authorization grant in use. In this case code for the authorization code. redirect_uri - The redirect URI for the application, URL encoded.

Any idea of how to do this in Paw would be greatly appreciated! Right now the only way I can figure it to do each call manually as a request and pass along the pertinent items.

thanks!

Mark


Solution

  • From what I see here, it should be nicely supported by Paw. Here's an example config that should fit your needs:

    enter image description here

    In Paw, if you do NOT check "Set client credentials in the body", it will set the Client Key and Secret in the Authorization header exactly as you described (base64, separated by a :, that's the Basic Auth format).

    Otherwise, things should be working ok. Let me know if you need any help.