
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
GraphAPI is a Ruby Gem created to simplifiy and help manage authentication using the Facebook Graph API.
Here is how to use it.
gem 'graph-api', require: 'graph_api'
You will have to configure the gem before using it. Here is an example setup.
GraphAPI.config do
app_secret '124ca2a483f12723cafa7a5da33a3492' # The Facebook Application Secret
client_id '234513432316919' # The Facebook Application Id
callback_url 'http://example.com/facebook_callback/' # URI for receiving the Facebook code param
logout_url 'http://example.com/logout/' # URI to redirect to when logging out
access_scope [:offline_access, :email, :user_photos] # The Facebook application requirements
user_fields [:id, :picture, :name, :gender, :email] # The user fields pulled for
end
Visit https://developers.facebook.com/apps to register your Facebook application or checkout https://developers.facebook.com/docs/reference/api/user/ for a list of user fields and permissions.
Once configured you will be able to use GraphAPI to retrieve any Facebook user fields in your application. Here is basic example using Sinatra.
get '/facebook_login' do
redirect GraphAPI.auth_url
end
get '/facebook_callback' do
@facebook_user = GraphAPI.new(false, params[:code])
session[:auth_token] = @facebook_user.auth_token
render :signed_in
end
get '/profile'
@facebook_user = GraphAPI.new(session[:auth_token])
logger.info "User #{@facebook_user.name} viewed their profile."
render :profile
end
WTFPL © 2012 Nick Barth
FAQs
Unknown package
We found that graph-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.