Comments (5)
These fixes also belong in the whole jquery-ajax-*
sequence.
First, #22
Also, this scheme (ish) for the JSON scripts:
#!/bin/bash
# API="http://httpbin.org"
# APIPATH="/post"
API="http://localhost:4741"
APIPATH="/sign-in"
curl ${API}${APIPATH} \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'${EMAIL}'",
"password": "'${PASSWORD}'"
}
}'
# data output from curl doesn't have a trailing newline
echo
from api-token-auth.
Did we come to a decision about whether or not it's OK to hard-code the vars inside the script? We discussed on Slack briefly in 015-planning
. @gaand and I argued against hard-coding, favoring passing at execution at the prompt. @payne-chris-r Noted a bug may occur with an incorrect token if the variables are hard-coded, and therefore leaked to the environment.
from api-token-auth.
I will deliver better scripts this time by sharing through 015-code
, then I'll save a gist and link it across the open issues.
from api-token-auth.
I haven't pushed the branch, but I'm making this change to rails-api-template
:
#!/bin/bash
-API="http://localhost:4741"
+API="${API_ORIGIN:-http://localhost:4741}"
URL_PATH="/sign-in"
curl "${API}${URL_PATH}" \
--include \
from api-token-auth.
I pushed ga-wdi-boston/rails-api-template@2b97302
from api-token-auth.
Related Issues (20)
- Solution is "behind" demo HOT 1
- Needs app.js file. HOT 3
- Importance of Auth and why we care HOT 1
- Update from talk template HOT 1
- Change httpbin reference to link HOT 2
- Boilerplate code isn't using pseudo promise syntax HOT 1
- Code consistency HOT 5
- test issue
- put api as a shell variable
- Specify API as shell variable HOT 1
- Create functions with `function` keyword? HOT 2
- How does one generate URL-econded strings for the scripts? HOT 1
- Show them an authenticated resource request?
- Rename to `jquery-ajax-auth`? HOT 1
- Duplicate scripts? HOT 3
- curl scripts need to use new format HOT 1
- `017/solution/index.htm` doesn't include a message area.
- Modify index.html for code along HOT 3
- Use `API` to hold url to make its purpose more clear. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-token-auth.