Socket
Socket
Sign inDemoInstall

@edcademy/imgur-auth

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @edcademy/imgur-auth

A simple code snippet for authenticating using imgur api


Version published
Weekly downloads
1
Maintainers
1
Install size
2.55 kB
Created
Weekly downloads
 

Readme

Source

Steps to use this snippet

  1. Run requestAccessToken function either by importing it from this utility or using the window.requestAccessToken in your browser console passing your clientId you obtained from imgur to it.
    It will redirect user to the imgur and authenticate them.
window.requestAccessToken(myClientId);
  1. Upon finishing authentication, imgur will redirect users back to your application. please make sure you have correct redirectUrl set in the imgur configs. Go to this link: (https://imgur.com/account/settings/apps)[https://imgur.com/account/settings/apps] and click on edit beneath the redirect column. set your redirect url to something like: http://localhost:3000/oauth-callback
  2. import OAuthCallback from this package and mount it on the endpoint you've set in the previous step. The following snippet is for the url in previous step:
<Route path="/oauth-callback" exact element={<OAuthCallback />} />
  1. (Optional) You can pass callbacks to OAuthCallback to navigate user away upon finishing authentication:
<Route
  path="/oauth-callback"
  exact
  element={
    <OAuthCallback onAuthenticationSucceed={() => history.replace('/')} />
  }
/>

FAQs

Last updated on 30 Jan 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc