rails-api | A simple rails api with jwt based authentication | Authentication library

 by   carlos-peru Ruby Version: Current License: No License

kandi X-RAY | rails-api Summary

kandi X-RAY | rails-api Summary

rails-api is a Ruby library typically used in Security, Authentication applications. rails-api has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A simple rails api with jwt based authentication implemented
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              rails-api has a low active ecosystem.
              It has 1 star(s) with 3 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              rails-api has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of rails-api is current.

            kandi-Quality Quality

              rails-api has 0 bugs and 0 code smells.

            kandi-Security Security

              rails-api has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              rails-api code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              rails-api does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              rails-api releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              It has 213 lines of code, 8 functions and 33 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rails-api
            Get all kandi verified functions for this library.

            rails-api Key Features

            No Key Features are available at this moment for rails-api.

            rails-api Examples and Code Snippets

            No Code Snippets are available at this moment for rails-api.

            Community Discussions

            QUESTION

            Problem with the logout on Rails API + Devise + JWT
            Asked 2021-Sep-03 at 11:50

            Im building a Rails API. All my devise routes working fine, execpt for one : the logout.

            I followed this tutorial : https://jameschambers.co.uk/rails-api

            I already tried few things, like :

            • tried the api/logout.json route
            • tried to change rb #111 for : config.skip_session_storage = [:http_auth, :params_auth] ( config/initializers/devise.rb )
            • tried to change rb #280 for : config.sign_out_via = :get ( config/initializers/devise.rb )

            Im sending a DELETE request on this address : localhost:3000/api/logout, with a JWT/Bearer token.

            error

            ...

            ANSWER

            Answered 2021-Sep-02 at 23:12

            The error ERROR: column jwt_denylist.exp does not exist indicates it's looking for a column (exp) that doesn't exist on the jwt_denylist table.

            Your schema shows you have an expired_at but no exp column.

            From the jwt-denylist gem the schema it expects exp. Perhaps the tutorial is out of date? Here's what the gem's documentation recommends:

            Source https://stackoverflow.com/questions/69037646

            QUESTION

            added root in grape api but not included in response
            Asked 2021-Aug-04 at 14:21

            I am following this article to learn about writing api using grape gem. But in the response I am not getting the root key. Here is my directory structure,

            ...

            ANSWER

            Answered 2021-Aug-03 at 11:23

            Dirty fix: use in app/controllers/api/v1/graduates.rb

            Source https://stackoverflow.com/questions/68624543

            QUESTION

            createAsyncThunk function returns userId undefined data attribute
            Asked 2021-Jul-31 at 16:38

            I'm trying to fetch appointment data from my rails-api backend using the createAsyncThunk function. When I

            ...

            ANSWER

            Answered 2021-Jul-31 at 16:38

            you will need the token from here

            Source https://stackoverflow.com/questions/68595864

            QUESTION

            Bad Gateway in Rails app with Kubernetes setup
            Asked 2021-Jun-28 at 21:23

            I try to setup a Rails app within a Kubernetes Cluster (which is created with k3d on my local machine.

            k3d cluster create --api-port 6550 -p "8081:80@loadbalancer" --agents 2

            kubectl create deployment nginx --image=nginx

            kubectl create service clusterip nginx --tcp=80:80

            ...

            ANSWER

            Answered 2021-Jun-28 at 21:23

            The problem was within the Dockerfile:

            I had not defined ENV RAILS_LOG_TO_STDOUT true, so I was not able to see any errors in the pod logs.

            After I added ENV RAILS_LOG_TO_STDOUT true I saw errors like database xxxx does not exist

            Source https://stackoverflow.com/questions/68081399

            QUESTION

            Bundler couldn't find compatable versions on bundle install in rails
            Asked 2021-Apr-11 at 04:57

            I have cloned an existing project and trying to run it in my system. Since this is the first time I don't have any Gemfile.lock file in my directory. I tried running bundle install and the following errors occur:

            ...

            ANSWER

            Answered 2021-Apr-10 at 18:06

            In your project directory, try installing rails gem install rails -v 4.1.6 and removing the version from the failing gems like (liquid_markdown, gon, etc..) then try running bundle update then bundle clean --force

            I think this might be an issue because all the version of these gems are locked inside your Gemfile

            Source https://stackoverflow.com/questions/67036420

            QUESTION

            JavaScript form fetch request submitting empty values when they are filled in
            Asked 2021-Feb-19 at 02:43

            I am creating a Login form in JavaScript and am trying to send this form to my Ruby on Rails backend.

            I have two problems:

            1. When the form loads, it triggers the eventListener and sends the blank form's data to the backend. I have e.preventDefault() commented out in the second function below because I kept getting the error that it is not a function. Note: in the backend for Rails, I get the following message when I type in params. "Permitted: false" concerns me. "sessions", "action"=>"create", "session"=>{}} permitted: false>

            2. When I fill in the form with an email and password and click the submit button, the loginData (from loginButton.addEventListener("submit", submitLogin(loginData) submits a blank value for the email and 'password' for the password (which are the default values I set to test the values) even though these elements are filled in in the form with an actual email address and password.

            Function loading login form (note: this loads just fine):

            ...

            ANSWER

            Answered 2021-Feb-19 at 02:43

            Your form is submitting automatically because of the way you've set the event handler. The .addEventListener() API requires a reference to a callback function as the second argument. But you passed a function call with arguments like this:

            loginButton.addEventListener("submit", submitLogin(loginData));

            You have two choices to fix this:

            1. Pass a reference.
              • This will require loginData to be available to the handler in some other fashion.

            loginButton.addEventListener("submit", submitLogin);

            1. Enclose the call within a function expression:

            loginButton.addEventListener("submit", ()=>submitLogin(loginData));

            Option 2 is generally preferred when needing to pass parameters to the handler. But you'll see below, for you, option one is the way to go.

            The leads to the next problem - submitLogin() function itself.

            Source https://stackoverflow.com/questions/66270829

            QUESTION

            How to add the executable file for "rails" to the $PATH of my container?
            Asked 2021-Feb-06 at 20:58
            Context: Setting up a Rails and nuxt project

            I was following step by step this article to no avail. I also cloned directly from author's repo and not only did I had the same issue but I am also not the onlyone

            Problem

            at runtime the container does not have access to the rails command

            docker-compose run backend /bin/bash

            ...

            ANSWER

            Answered 2021-Feb-06 at 20:58

            Ruby applications generally use a tool called Bundler to manage their application's dependencies. If your application depends on the rails gem, which provides a rails executable, that will often be in vendor/bin/rails or somewhere similar, but not on the standard $PATH.

            The quickest way to make this work is to use the bundle exec wrapper, which knows how to set up paths accordingly.

            Source https://stackoverflow.com/questions/66081542

            QUESTION

            Ruby on Rails API namespace as default path
            Asked 2020-Nov-07 at 13:54

            I am setting up my Rails API server following this tutorial: building-awesome-rails-apis-part-1

            Everything works well, except the part that mentions that it is not necessary to indicate the namespace in the route. Eg.

            Now our URls look like: http://api.example.com/v1/people or just http://api.example.com/people if you don’t use the version, it doesn’t interfere with your regular people routes, and it looks great.

            When I call http://api.mydomain.com/v1/therapists/ it works, but when I try to omit the v1 namespace in the URL it's not working, do I need to do any extra configuration?

            I'm using Rails 6.0.3.4

            This is my specific routes.rb file:

            ...

            ANSWER

            Answered 2020-Nov-05 at 19:30

            If you omit the v1 namespace in the URL, you must also remove it from your routes.rb file.

            The quote from the tutorial stated "or just http://api.example.com/people if you don’t use the version", meaning if you don't include the v1 namespace in the routes.rb file.

            Source https://stackoverflow.com/questions/64703421

            QUESTION

            React Follow Function activates on page load
            Asked 2020-Sep-07 at 20:44

            I am trying to implement a follow/unfollow function in a react rails-api web application. Currently the follow and unfollow post/delete just fine when I click the follow/unfollow button.

            However, whenever a user visits another users page it will follow/unfollow when the page loads without clicking the follow/unfollow button. I do not understand why this is happening since I have, for my post/delete, the useEffect second param set to go off when the state for my follow/unfollow changes.

            Please help me figure out why this is happening and how to prevent this. Let me know if more information is needed.

            ...

            ANSWER

            Answered 2020-Sep-07 at 20:44
            import React, {useState, useEffect} from 'react'
            import {Link, useParams} from 'react-router-dom'
            import decode from 'jwt-decode'
            function NotUserPage() {
                const {id} = useParams()
                const [user, setUser] = useState({})
                const loggedUser = decode(localStorage.getItem("token"))
                const username = loggedUser.username
                const userId = loggedUser.user_id 
                const [following, setFollowing] = useState(false)
              
                const fetchUserData = () => {
                    fetch(`http://localhost:3000/users/${id}`)
                        .then(res => res.json())
                        .then(data => setUser(data))
                }
            
                useEffect(() => {
                    fetchUserData()
                }, [])
            
                const unFollow = () => {
                    fetch(`http://localhost:3000/users/${id}/unfollow`, {
                        method: "POST",
                        body:  JSON.stringify({
                            follower_id: userId,
                            followee_id: id
                        }),
                        headers: {
                            "Content-type": "application/json",
                            "Authorization": `bearer ${localStorage.getItem("token")}`,
                          },
                        
                        })
                        .then(res => res.json())
                        .then(data => console.log(data))
                        .then(() => setFollowing(false))
                            
                }
             
                const handleFollow = () => {
                    fetch(`http://localhost:3000/users/${id}/follow`, {
                        method: "POST",
                        body:  JSON.stringify({
                            follower_id: userId,
                            followee_id: id
                        }),
                        headers: {
                            "Content-type": "application/json",
                            "Authorization": `bearer ${localStorage.getItem("token")}`,
                          },
                        
                        })
                        .then(res => res.json())
                        .then(data => console.log(data))
                        .then(() => setFollowing(true))
                            
                }
              
                const fButton = () => following ? unFollow() : handleFollow();
            
            
                return (
                    
                       {user.username} 
                       follow
                    
                )
            }
            
            export default NotUserPage
            

            Source https://stackoverflow.com/questions/63782326

            QUESTION

            Devise token auth not returning token on sign in
            Asked 2020-Aug-05 at 15:21

            I've followed the tutorials here and here.

            I can create a user and get a successful response from sign_in, but that sign in does not contain an access token to be used in future requests.

            Also I can confirm that tokens are being created and saved in the db.

            Registration request

            ...

            ANSWER

            Answered 2020-Aug-05 at 15:21

            Silly error on my part.

            I just needed to change curl -XGET to curl -v -XGET to display the headers, which included the tokens.

            Source https://stackoverflow.com/questions/63252534

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install rails-api

            Install rails
            Install postgresql
            Then:

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/carlos-peru/rails-api.git

          • CLI

            gh repo clone carlos-peru/rails-api

          • sshUrl

            git@github.com:carlos-peru/rails-api.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Authentication Libraries

            supabase

            by supabase

            iosched

            by google

            monica

            by monicahq

            authelia

            by authelia

            hydra

            by ory

            Try Top Libraries by carlos-peru

            next-with-api

            by carlos-peruJavaScript

            ListCompaniesLinkedInApi

            by carlos-peruPHP

            scraper

            by carlos-peruRuby

            gateway

            by carlos-peruRuby

            Hack

            by carlos-peruHTML