I just installed Restful Authentication.
After someone has successfully logged in, they write a review -- as you would a comment for a blog.
How do I know the value of the user_id column for the authenticater user so I can put that into the reviews table to match user to review?
Thanks.
I'm not 100% sure of this, but try #current_user.id in your controller
Related
I am new to laravel and creating a REST API. The client of the API will be mobile app only. There is no front end view to be shown in browser. I have created the routes and the controllers to handle API requests. Furthermore I deleted the Users table (created by laravel) because I do not need an Web interface etc.
I just want simple token based authentication at this stage ( I am aware there is passport authentication) but I can not even understand that at this stage.
There is only one table in the project.
Candidates
(id (PK), name, phone, details)
mobile app users are candidates also, should I create a token column in this table ? and manually create token at the time of register API and return it back as response ?
Please any simple guide or directions will help, I have search quite a bit online and there seems to be quite a lot many topics that show up such as guards, providers, passport which I am struggling to get.
Thanks,
Elliot.
First of all, you didn’t need to delete the users table. You can use it for api auth too. You just need to create a seperate token table.
However, if you want to implementit manually you need to do a lot of things manually.
This is a huge thing to impelement manually and it's not possible to describe it in a single answer. I will try my best to explain it as simply as I can.
You have to create a authentication system yourself that is for login. Define a middleware to check the authorization of the token sent from client to check the validity of every request (this is the guard part).
Also keep track of the token expiry time. Refreshing the token after each expiry needs to be done too (this is the provider part).
Now there are a lot things inside. Like keeping track of the device the request is coming from, providing different tokens for differenet devices for a single user etc.
If you are into learning how everything works then you can try to build one yourself. But if you plan on deploying it to a professional website, I would suggest try to get accustomed with passport. Reinventing the wheel is really not necessary. I hope it gives you a basic idea. If you have any more questions feel free to comment.
Please let me know, if any Inputs on how to make a Yammer Group Admin, or add user as group admin.
Thanks.
There is an api endpoint which is not in the documentation bu being used by the Yammer App itself.
User must be in the group before, it will not add the user itself.
Make Admin:
https://www.yammer.com/api/v1/groups/{groupId}/make_admin?user_id={userId}
Revoke Admin:
https://www.yammer.com/api/v1/groups/{groupId}/revoke_admin?user_id={userId}
Hope this is still helpfull, since the posting date is really old.
I'm trying to build a platform where a Supplier can login to the platform, a normal web login.
But from the outside webshops can place orders using my REST API. Each webshop should be able to place an order but how would I go about authenticating those webshops?
Should I generate a sort of token for each webshop which they have to send in each request? Is it possible using JWT to issue a token to each shop that they will use for life? And so I know which shop is trying to create an order?
Looking very forward to your ideas.
Thank you.
Since you've mentioned laravel in the topic, try Passport
Here is a nice introduction blog post about it:
https://mattstauffer.co/blog/introducing-laravel-passport
You can have it up and running within hours, good luck!
Hi there is many package can do this including Passport as mentioned by #veNuker
my sugestion use Api-Guard is easy to use
I use Instagram API to get all comments include text comment and someone's comment, but I only get my comment. I use
https://api.instagram.com/v1/media/{media-id}/comments?access_token=ACCESS-TOKEN
Any solution?
It seems your app is in Sandbox. In sandbox mode you get your own data and other sandbox invited users data but can't get any public user data.
To get other users data you must submit your app with valid case. If they approve your app then you can use your app to get any public user data.
I am using TweetSharp for user login in my asp.net mvc web app. All works fine but after login I need to save the user data in my DB as well. I cant find email from TwitterUser object after loging. How can i get user's email once the user is authenticated?
thanks
You cannot. The Twitter API doesn't return email addresses for users.
Take a look at the users/show documentation to see all the information you can retrieve.
If your app is whitelisted, you can now retrieve the email as part of verify_credentials https://dev.twitter.com/rest/reference/get/account/verify_credentials