API Gateway & OAuth & API key
Last updated
Was this helpful?
Last updated
Was this helpful?
RFC 6749 - The OAuth 2.0 Authorization Framework
OAuth was created as a delegated authorization protocol. It has been extended to be used as a single-sign-on protocol through things like OpenID Connect, but that was not its original goal.
https://developers.google.com/maps/api-security-best-practices
the mobile client shouldn't save secret key but use
HTTP referrers
Specify one or more referrer web sites. Wildcard characters are acceptable for authorizing all subdomains (for example, *.google.com
accepts all sites ending in .google.com
).
IP addresses
Specify one IPv4 or IPv6 address or a subnet using CIDR notation. Since a web service web service request checks and compares the external IP address against the API key restriction, use the server's public IP address.
Android apps
Add your SHA-1 signing-certificate fingerprint and your Android package name from your AndroidManifest.xml
file.
iOS apps
Below the types, select the appropriate iOS bundle identifier from the list.
client_id
domain
very simple it's basically hash table which means we can use a database
easy to revoke
token data is not visible
must be stored
requires a network to validate
JWT is one of the famous Self-Encoded Tokens.
RFC 7523 - JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants
is the standard for JWT based Self-Encoded Tokens
don't need to shared storage
can be validated without network
JWT contents are visible
No way to revoke
when publish token describes
x_client_id
x_client_type
string [internal, 3rd-party, etc...]
dispatch logic
x_token_type
x_token_version
string [v0.1, v1.0, v2.1, etc...]
for manage token migration
x_domain
iss (standard)
issuer
UUID
logging (do not recommend control API through this.)
jti (standard)
JWT ID
UUID
same client can issues multiple token. so token_id is not an option for logging
iat (standard)
Issued At Time Clame
number
it's standard field for 'Issued At Time claim'
expires_in (standard)
number
here is JWT structure
which means we don't need to save SECRET_KEY
because we can generate on server in real time.