All Projects → marcocastignoli → Rust_rocket_api_authentication

marcocastignoli / Rust_rocket_api_authentication

An example of API written in Rust with the rocket.rs framework, with a JWT Authentication

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rust rocket api authentication

Securing Restful Apis With Jwt
How to secure a Nodejs RESTful CRUD API using JSON web tokens?
Stars: ✭ 301 (+267.07%)
Mutual labels:  api, tutorial, authentication
Jso
Easy to use OAuth 2.0 javascript library for use in your javascript application.
Stars: ✭ 830 (+912.2%)
Mutual labels:  api, authentication
Github Create Token
Create a Github OAuth access token.
Stars: ✭ 6 (-92.68%)
Mutual labels:  api, authentication
Sdmx Rest
This repository is used for maintaining the SDMX RESTful web services specification.
Stars: ✭ 50 (-39.02%)
Mutual labels:  api, webservice
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (+595.12%)
Mutual labels:  api, authentication
Just Api
💥 Test REST, GraphQL APIs
Stars: ✭ 768 (+836.59%)
Mutual labels:  api, webservice
Intro To Apis Course
Introduction to APIs course
Stars: ✭ 1,009 (+1130.49%)
Mutual labels:  api, tutorial
Spacex Api
🚀 Open Source REST API for SpaceX launch, rocket, core, capsule, starlink, launchpad, and landing pad data.
Stars: ✭ 8,973 (+10842.68%)
Mutual labels:  api, rocket
Djaoapp
User login, billing, access control as part of a session proxy
Stars: ✭ 61 (-25.61%)
Mutual labels:  api, authentication
Flask Tutorial
A tutorial to build your first flask application
Stars: ✭ 58 (-29.27%)
Mutual labels:  api, tutorial
Rails5 api tutorial
Learn how to build a modern API on Michael Hartl's Rails 5 tutorial
Stars: ✭ 458 (+458.54%)
Mutual labels:  api, tutorial
Auth0 Python Api Samples
Auth0 Integration Samples for Python REST API Services using Flask
Stars: ✭ 70 (-14.63%)
Mutual labels:  api, authentication
Annon.api
Configurable API gateway that acts as a reverse proxy with a plugin system.
Stars: ✭ 306 (+273.17%)
Mutual labels:  api, authentication
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+870.73%)
Mutual labels:  api, authentication
Devise token auth
Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.
Stars: ✭ 3,263 (+3879.27%)
Mutual labels:  api, authentication
Offit
Simple but powerful API mocking library. Make mocks great again.
Stars: ✭ 25 (-69.51%)
Mutual labels:  api, webservice
Nodejs Restful Api
How to create a RESTful CRUD API using Nodejs?
Stars: ✭ 285 (+247.56%)
Mutual labels:  api, tutorial
Express Graphql Mongodb Boilerplate
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).
Stars: ✭ 288 (+251.22%)
Mutual labels:  api, authentication
Lofocats ui
LofoCats UI is a simple web application consuming the LofoCats API, built with Ruby on Rails 🐱
Stars: ✭ 54 (-34.15%)
Mutual labels:  api, tutorial
Auth0 Express Api Samples
Auth0 Integration Samples for Node Express REST API Services
Stars: ✭ 68 (-17.07%)
Mutual labels:  api, authentication

Rust rocket.rs - API with Authentication

An example of API written in Rust with the rocket.rs framework, with a JWT Authentication

Requirements

  1. Configure Rust to satisfy rocket.rs dependencies

Installation

  1. First run the migration
    diesel migration run
    
  2. Compile the code setting the DATABASE_URL environment variable
        export DATABASE_URL=mysql://username:[email protected]/heroes && cargo run
    

API

/auth/login

Get a jwt token for the user marcocastignoli

curl -X POST \
  http://localhost:8000/auth/login \
  -H 'content-type: application/json' \
  -d '{
	"username": "marcocastignoli",
	"password": "12345"
}'

/user

Call a protected route (use the token returned from the /auth/login API)

curl -X GET \
  http://localhost:8000/user \
  -H 'authentication: eyJ0eXAiOiJKV1QiLCJraWQiOm51bGwsImFsZyI6IkhTMjU2In0.eyJpc3MiOm51bGwsInN1YiI6Im1hcmNvY2FzdGlnbm9saSIsImF1ZCI6bnVsbCwiZXhwIjpudWxsLCJuYmYiOm51bGwsImlhdCI6bnVsbCwianRpIjpudWxsfQ.fnp0D8Qh1bTFv1zKTVGAxwjtyTCOqKuarRzBQabjiCI'

Thanks

Special thanks to @sean3z for this repo https://github.com/sean3z/rocket-diesel-rest-api-example and this tutorial https://medium.com/sean3z/building-a-restful-crud-api-with-rust-1867308352d8

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].